You are here

function taxonomy_hierarchical_select_update_form_item in Hierarchical Select 5.2

Sets certain Hierarchical Select settings, based on the vid. The user can configure this on the vocabulary administration page, this function applies those settings.

Parameters

$form_item: The form item to update.

$vid: The id of the vocabulary of which the settings should be applied.

2 calls to taxonomy_hierarchical_select_update_form_item()
content_taxonomy_hierarchical_select_form_alter in modules/content_taxonomy.inc
Implementation of hook_hierarchical_select_form_alter().
taxonomy_hierarchical_select_form_alter in modules/taxonomy.inc
Implementation of hook_hierarchical_select_form_alter().

File

modules/taxonomy.inc, line 423

Code

function taxonomy_hierarchical_select_update_form_item(&$form_item, $vid) {
  $enforce_deepest = variable_get("hierarchical_select_enforce_deepest_{$vid}", HS_TAXONOMY_DONT_ENFORCE_DEEPEST);
  $form_item['#multiple'] = variable_get("hierarchical_select_multiple_{$vid}", 0);
  $form_item['#hierarchical_select_settings']['save_lineage'] = _taxonomy_hierarchical_select_get_save_linage($vid);
  $form_item['#hierarchical_select_settings']['enforce_deepest'] = $enforce_deepest;
  $form_item['#hierarchical_select_settings']['all_option'] = (bool) variable_get("hierarchical_select_all_option_{$vid}", HS_TAXONOMY_DONT_ADD_ALL_OPTION);
  if (variable_get("hierarchical_select_level_labels_status_{$vid}", 0) == 1) {
    $form_item['#hierarchical_select_settings']['level_labels'][0] = variable_get("hierarchical_select_level_0_{$vid}", '');
    if ($enforce_deepest == HS_TAXONOMY_DONT_ENFORCE_DEEPEST) {
      for ($depth = 1; $depth <= _taxonomy_hierarchical_select_get_depth($vid); $depth++) {
        $form_item['#hierarchical_select_settings']['level_labels'][$depth] = variable_get("hierarchical_select_level_{$depth}_{$vid}", '');
      }
    }
  }
  $form_item['#hierarchical_select_settings']['dropbox_title'] = variable_get("hierarchical_select_dropbox_title_{$vid}", '');
  $form_item['#hierarchical_select_settings']['dropbox_limit'] = variable_get("hierarchical_select_dropbox_limit_{$vid}", 0);
}