You are here

function taxonomy_machine_name_form_vocabulary_validate in Taxonomy Machine Name 7

Implements hook_form_validate().

1 string reference to 'taxonomy_machine_name_form_vocabulary_validate'
taxonomy_machine_name_form_alter in ./taxonomy_machine_name.module
Implements hook_form_alter().

File

./taxonomy_machine_name.module, line 304

Code

function taxonomy_machine_name_form_vocabulary_validate($form, &$form_state) {

  // During the deletion there is no 'machine_name' key.
  if (isset($form_state['values']['machine_name'])) {

    // Do not allow machine names to conflict with taxonomy path arguments.
    $machine_name = $form_state['values']['machine_name'];
    $disallowed = array(
      'add',
      'list',
    );
    if (in_array($machine_name, $disallowed)) {
      form_set_error('machine_name', t('The machine-readable name cannot be "add" or "list".'));
    }
  }
}