You are here

function content_taxonomy_views_field_terms_by_parent in Content Taxonomy 5

Display all the terms for a given parent term

File

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

Code

function content_taxonomy_views_field_terms_by_parent($fieldinfo, $fielddata, $value, $data) {
  $terms = array();
  $names = array();
  if ($fieldinfo['parent']) {
    $terms = content_taxonomy_terms_by_field(node_load($data->nid), $fieldinfo['voc_id'], $fieldinfo['parent'], 1);
  }
  if (is_array($terms)) {
    foreach ($terms as $term) {
      $names[] = $term->name;
    }
    return implode(', ', $names);
  }
}