You are here

function theme_checkbox_tree_level in Taxonomy Term Reference Tree Widget 8

Same name and namespace in other branches
  1. 7.2 term_reference_tree.widget.inc \theme_checkbox_tree_level()
  2. 7 term_reference_tree.widget.inc \theme_checkbox_tree_level()

This function prints a list item with a checkbox and an unordered list of all the elements inside it.

1 string reference to 'theme_checkbox_tree_level'
term_reference_tree_theme in ./term_reference_tree.module
Implements hook_theme().
1 theme call to theme_checkbox_tree_level()
CheckboxTreeLevel::getInfo in src/Element/CheckboxTreeLevel.php
Returns the element properties for this element.

File

./term_reference_tree.module, line 100

Code

function theme_checkbox_tree_level($variables) {
  $element = $variables['element'];
  $sm = '';
  if (array_key_exists('#level_start_minimized', $element) && $element['#level_start_minimized']) {
    $sm = ' style="display: none;"';
  }
  $output = '<ul class="term-reference-tree-level "' . $sm . '>';
  $children = Element::children($element);
  foreach ($children as $child) {
    $output .= '<li>';
    $output .= \Drupal::service('renderer')
      ->render($element[$child]);
    $output .= '</li>';
  }
  $output .= '</ul>';
  return $output;
}