function _patterns_taxonomy_term_select in Patterns 6.2
Same name and namespace in other branches
- 6 patterns.module \_patterns_taxonomy_term_select()
Custom implementation of Drupal's _taxonomy_term_select()
Used to override static caching in taxonmy_get_tree() which is preventing terms added during patterns execution to be included in parents and relations dropdowns and causes validation errors. Hopefully, we can find better solution for this.
2 calls to _patterns_taxonomy_term_select()
- patterns_form_alter in ./
patterns.module - _patterns_taxonomy_form in ./
patterns.module - Custom implementation of Drupal's taxonomy_form()
File
- ./
patterns.module, line 3061 - Enables extremely simple adding/removing features to your site with minimal to no configuration
Code
function _patterns_taxonomy_term_select($title, $name, $value, $vocabulary_id, $description, $multiple, $blank, $exclude = array()) {
$tree = _patterns_taxonomy_get_tree($vocabulary_id);
$options = array();
if ($blank) {
$options[''] = $blank;
}
if ($tree) {
foreach ($tree as $term) {
if (!in_array($term->tid, $exclude)) {
$choice = new stdClass();
$choice->option = array(
$term->tid => str_repeat('-', $term->depth) . $term->name,
);
$options[] = $choice;
}
}
}
return array(
'#type' => 'select',
'#title' => $title,
'#default_value' => $value,
'#options' => $options,
'#description' => $description,
'#multiple' => $multiple,
'#size' => $multiple ? min(9, count($options)) : 0,
'#weight' => -15,
'#theme' => 'taxonomy_term_select',
);
}