function taxonomy_unique_form_taxonomy_term_form_alter in Taxonomy unique 8
File
- ./
taxonomy_unique.module, line 41
Code
function taxonomy_unique_form_taxonomy_term_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// If the terms in this vocabulary should be unique,
// attach custom validate function to the form.
if (\Drupal::config('taxonomy_unique.settings')
->get($form_state
->getFormObject()
->getEntity()
->getVocabularyId())) {
$form['#validate'][] = 'taxonomy_unique_term_name_validate';
}
}