function content_taxonomy_allowed_values_groups in Content Taxonomy 6.2
Same name and namespace in other branches
- 6 content_taxonomy.module \content_taxonomy_allowed_values_groups()
Creating Opt Groups for content_taxonomy_options
1 call to content_taxonomy_allowed_values_groups()
- content_taxonomy_allowed_values in ./
content_taxonomy.module - Called by content_allowed_values to create the $options array for the content_taxonomy_options
File
- ./
content_taxonomy.module, line 292 - Defines a field type for referencing a taxonomy term.
Code
function content_taxonomy_allowed_values_groups($field) {
$options = array();
$parent = content_taxonomy_field_get_parent($field);
$group_parent = $field['widget']['group_parent'];
//if children in no group
$default_terms = taxonomy_get_children($parent, $field['vid']);
foreach ($default_terms as $default_term) {
_content_taxonomy_localize_term($default_term);
$options[$default_term->tid] = check_plain($default_term->name);
}
foreach (taxonomy_get_children($group_parent) as $group) {
foreach (taxonomy_get_children($group->tid) as $term) {
_content_taxonomy_localize_term($term);
$options[$group->name][$term->tid] = check_plain($term->name);
unset($options[$term->tid]);
}
unset($options[$group->tid]);
}
return $options;
}