You are here

function hs_taxonomy_hierarchical_select_children in Hierarchical Select 6.3

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

Implementation of hook_hierarchical_select_children().

1 call to hs_taxonomy_hierarchical_select_children()
hs_taxonomy_views_hierarchical_select_children in modules/hs_taxonomy_views.module
Implementation of hook_hierarchical_select_children().

File

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

Code

function hs_taxonomy_hierarchical_select_children($parent, $params) {
  if (isset($params['root_term']) && $params['root_term'] && $parent == 0) {
    return array();
  }
  $terms = taxonomy_get_children($parent, $params['vid']);

  // Unset the term that's being excluded, if it is among the children.
  unset($terms[$params['exclude_tid']]);

  // If the Term Permissions module is installed, honor its settings.
  if (function_exists('term_permissions_allowed')) {
    global $user;
    foreach ($terms as $key => $term) {
      if (!term_permissions_allowed($term->tid, $user)) {
        unset($terms[$key]);
      }
    }
  }
  return _hs_taxonomy_hierarchical_select_terms_to_options($terms);
}