public function MenuLinkTreeHandler::isMenuLinkDisplayedChildren in Menu Item Extras 8.2
Checks if Menu Link Children is enabled to display.
Parameters
\Drupal\Core\Menu\MenuLinkInterface $link: Original link entity.
Return value
bool Returns TRUE is Menu Link Children is enabled in display.
Overrides MenuLinkTreeHandlerInterface::isMenuLinkDisplayedChildren
File
- src/
Service/ MenuLinkTreeHandler.php, line 122
Class
- MenuLinkTreeHandler
- Class MenuLinkTreeHandler.
Namespace
Drupal\menu_item_extras\ServiceCode
public function isMenuLinkDisplayedChildren(MenuLinkInterface $link) {
/** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_item */
$entity = $this
->getMenuLinkItemEntity($link);
if ($entity) {
$view_mode = $this
->getMenuLinkContentViewMode($entity);
/* @var \Drupal\Core\Entity\Entity\EntityViewDisplay $display */
$display = $this->entityTypeManager
->getStorage('entity_view_display')
->load($entity
->getEntityTypeId() . '.' . $entity
->bundle() . '.' . $view_mode);
if ($display
->getComponent('children')) {
return TRUE;
}
}
return FALSE;
}