Since title field is considered as base field in Drupal 8, I opted hook_entity_base_field_info_alter to add validation to it. But when I look at that hook.

hook_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type)

It doesn't holds a $bundle argument. So I couldn't add a validation for title field of a particular node type. How can I override it to be node type specific?

2 Answers 2


Base fields are by definition not bundle specific, you can't add something for a specific bundle in that hook.

However, what you can do is save it as a base field override. See how NodeTypeForm::save saves different default values and labels for base fields as base field overrides.


You can check too node title validation https://www.drupal.org/project/node_title_validation

This module check unique titles, max & min characters and blacklist words.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.