You are here

function hs_taxonomy_hierarchical_select_config_info in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.3 modules/hs_taxonomy.module \hs_taxonomy_hierarchical_select_config_info()
  2. 7.3 modules/hs_taxonomy.module \hs_taxonomy_hierarchical_select_config_info()

Implementation of hook_hierarchical_select_config_info().

File

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

Code

function hs_taxonomy_hierarchical_select_config_info() {
  static $config_info;
  if (!isset($config_info)) {
    $config_info = array();
    $content_types = node_get_types();
    $vocabularies = taxonomy_get_vocabularies();
    foreach ($vocabularies as $vid => $vocabulary) {
      if (variable_get("taxonomy_hierarchical_select_{$vid}", 0)) {

        // Collect the human-readable names of each content type for which this
        // vocabulary is used.
        $entities = array();
        foreach ($vocabulary->nodes as $content_type) {
          $entities[] = $content_types[$content_type]->name;
        }
        $config_id = "taxonomy-{$vid}";
        $config_info[$config_id] = array(
          'config_id' => $config_id,
          'hierarchy type' => t('Taxonomy'),
          'hierarchy' => t($vocabulary->name),
          'entity type' => t('Node'),
          'entity' => implode(', ', array_map('t', $entities)),
          'context type' => t('Node form'),
          'context' => '',
          'edit link' => "admin/content/taxonomy/edit/vocabulary/{$vid}",
        );
      }
    }
  }
  return $config_info;
}