function theme_checkbox_tree_item in Taxonomy Term Reference Tree Widget 8
Same name and namespace in other branches
- 7.2 term_reference_tree.widget.inc \theme_checkbox_tree_item()
- 7 term_reference_tree.widget.inc \theme_checkbox_tree_item()
This function prints a single item in the tree, followed by that item's children (which may be another checkbox_tree_level).
1 string reference to 'theme_checkbox_tree_item'
- term_reference_tree_theme in ./
term_reference_tree.module - Implements hook_theme().
1 theme call to theme_checkbox_tree_item()
- CheckboxTreeItem::getInfo in src/
Element/ CheckboxTreeItem.php - Returns the element properties for this element.
File
- ./
term_reference_tree.module, line 124
Code
function theme_checkbox_tree_item($variables) {
$element = $variables['element'];
$children = Element::children($element);
$output = '';
$sm = $element['#level_start_minimized'] ? ' term-reference-tree-collapsed' : '';
if (is_array($children) && count($children) > 1) {
$output .= '<div class="term-reference-tree-button' . $sm . '"></div>';
}
elseif (!$element['#leaves_only']) {
$output .= '<div class="no-term-reference-tree-button"></div>';
}
foreach ($children as $child) {
$output .= \Drupal::service('renderer')
->render($element[$child]);
}
return $output;
}