private function MenuTree::calculateItemCssClass in Taxonomy Facets 8
1 call to MenuTree::calculateItemCssClass()
File
- src/
MenuTree.php, line 77
Class
Namespace
Drupal\taxonomy_facetsCode
private function calculateItemCssClass($menuItemInChildrenLeafs, $tid) {
// Check if the current term in this loop has any children.
$hasChildren = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadTree($this->vid, $tid, 1);
$return['leafClass'] = 'menu-item';
if ($hasChildren) {
if ($menuItemInChildrenLeafs || $this
->menuItemIsFilterApplied($tid)) {
$return['leafClass'] .= ' menu-item--expanded menu-item--active-trail';
}
else {
$return['leafClass'] .= ' menu-item--collapsed';
}
}
$return['leafAnchorClass'] = NULL;
if ($this
->menuItemIsFilterApplied($tid)) {
$return['leafAnchorClass'] = "is-active";
}
return $return;
}