You are here

function hs_taxonomy_form in Hierarchical Select 6.3

1 string reference to 'hs_taxonomy_form'
hs_taxonomy_form_alter in modules/hs_taxonomy.module
Implementation of hook_form_alter().

File

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

Code

function hs_taxonomy_form($vid, $value = 0, $help = NULL) {
  require_once drupal_get_path('module', 'hierarchical_select') . '/includes/common.inc';
  $vocabulary = taxonomy_vocabulary_load($vid);
  if (module_exists('i18ntaxonomy')) {
    $title = check_plain(tt("taxonomy:vocabulary:{$vid}:name", $vocabulary->name));
    $description = check_plain($help ? $help : tt("taxonomy:vocabulary:{$vid}:help", $vocabulary->help));
  }
  else {
    $title = check_plain($vocabulary->name);
    $description = check_plain($help ? $help : $vocabulary->help);
  }
  $form_item = array(
    '#type' => 'hierarchical_select',
    '#config' => array(
      'module' => 'hs_taxonomy',
      'params' => array(
        'vid' => $vid,
        'exclude_tid' => NULL,
        'root_term' => NULL,
        'entity_count_for_node_type' => NULL,
      ),
    ),
    '#title' => $title,
    '#default_value' => $value,
    '#description' => $description,
    '#weight' => -15,
  );
  hierarchical_select_common_config_apply($form_item, "taxonomy-{$vid}");
  return $form_item;
}