You are here

function taxonomy_unique_entity_base_field_info_alter in Taxonomy unique 8.2

Implements hook_entity_base_field_info_alter().

File

./taxonomy_unique.module, line 59

Code

function taxonomy_unique_entity_base_field_info_alter(&$fields, EntityTypeInterface $entityType) {
  if ($entityType
    ->id() == 'taxonomy_term') {
    if (!empty($fields['name'])) {
      $fields['name']
        ->addConstraint("taxonomy_unique");
    }
  }
}