Making title unique using hook_entity_bundle_field_info_alter() hook_node_validate() is replaced by hook_entity_bundle_field_info_alter() in Drupal 8.

I need to validate the node title whether the same title is used in any other node. Title field should be unique for me. 

How can I define that in hook_entity_bundle_field_info_alter()? When I print something in this hook. It didn't called when I save the node. 

function my_module_entity_bundle_field_info_alter(&amp;$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type-&gt;id() == 'node') {
    dpm($entity_type);
  }
}


What am I doing wrong?
This hook only runs with a cold cache.
In Drupal 8 validation is done with plugins.

When this hook runs for the node entity type, you will have an array of fields, one of which is title. You need to define a new validation constraint plugin. Model it on the unique feed title or unique username one and that way you'll only have to write one method and a property or two.
Take note of your plugin's ID. When you're in that hook, call addConstraint on the title field, passing your plugin ID.

I have a feeling there's another hook too, maybe hook_entity_base_field_info_alter, but I could be wrong there. If you don't see title in the field list, check the api docs for a hook with base field in the name