You are here

function hierarchical_select_taxonomy_form_vocabulary_validate in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 5.2 modules/taxonomy.inc \hierarchical_select_taxonomy_form_vocabulary_validate()
  2. 6.3 modules/hs_taxonomy.module \hierarchical_select_taxonomy_form_vocabulary_validate()

Additional validate callback for the taxonomy_form_vocabulary form.

File

modules/hs_taxonomy.module, line 540
Implementation of the Hierarchical Select API for the Taxonomy module.

Code

function hierarchical_select_taxonomy_form_vocabulary_validate($form_id, $form_values, $form) {

  // If Hierarchical Select is enabled, the "multiple select" setting must be
  // managed by Hierarchical Select.
  // TRICKY: the "multiple select" setting is absent for the forum vocabulary!
  if ($form_values['hierarchical_select_status'] && isset($form['multiple'])) {

    // Enable Taxonomy's "multiple select" setting when:
    // - Hierarchical Select's "multiple select" setting is enabled, or:
    // - Hierarchical Select's "save term lineage" setting is enabled
    $multiple_select_enabled = $form_values['hierarchical_select']['dropbox']['status'] || $form_values['hierarchical_select']['save_lineage'];
    form_set_value($form['multiple'], (int) $multiple_select_enabled);
  }

  // If Hierarchical Select is enabled, disable freetagging.
  if ($form_values['hierarchical_select_status']) {
    form_set_value($form['tags'], 0);
  }
}