function _term_reference_tree_get_options in Taxonomy Term Reference Tree Widget 7.2
Same name and namespace in other branches
- 8 term_reference_tree.module \_term_reference_tree_get_options()
Return an array of options.
This function converts a list of taxonomy terms to a key/value list of options.
Parameters
$terms: An array of taxonomy term IDs.
$allowed: An array containing the terms allowed by the filter view
$filter: A string defining the view to filter by (only used to detect whether view filtering is enabled
Return value
A key/value array of taxonomy terms (name => id)
1 call to _term_reference_tree_get_options()
- term_reference_tree_process_checkbox_tree in ./
term_reference_tree.widget.inc - Process the checkbox_tree widget.
File
- ./
term_reference_tree.module, line 212
Code
function _term_reference_tree_get_options(&$terms, &$allowed, $filter) {
$options = array();
if (is_array($terms) && count($terms) > 0) {
foreach ($terms as $term) {
if (!$filter || is_array($allowed) && $allowed[$term->tid]) {
$options[$term->tid] = entity_label('taxonomy_term', $term);
$options += _term_reference_tree_get_options($term->children, $allowed, $filter);
}
}
}
return $options;
}