You are here

function views_handler_filter_terms_by_parent in Content Taxonomy 5

Create a list of terms for a given parent, optional with optgroups

1 string reference to 'views_handler_filter_terms_by_parent'
content_taxonomy_views_views_tables in ./content_taxonomy_views.module

File

./content_taxonomy_views.module, line 310
Views Support for content_taxonomy

Code

function views_handler_filter_terms_by_parent($op, $filterinfo) {
  $options = array();
  foreach (taxonomy_get_children($filterinfo['parent']) as $term) {
    $options[$term->tid] = $term->name;
  }
  if ($filterinfo['group']) {
    foreach (taxonomy_get_children($filterinfo['group']) as $group) {
      foreach (taxonomy_get_children($group->tid) as $term) {
        $options[$group->name][$term->tid] = $term->name;
        unset($options[$term->tid]);
      }
    }
  }
  return $options;
}