public function SimpleMegaMenuHelper::menuIsTargetedByMegaMenuType in Simple Mega Menu 8
Same name and namespace in other branches
- 2.0.x src/SimpleMegaMenuHelper.php \Drupal\simple_megamenu\SimpleMegaMenuHelper::menuIsTargetedByMegaMenuType()
Is the menu is referenced by a SimpleMegaMenuType entity.
Parameters
string $menu_name: The menu name.
Return value
bool TRUE, if the menu is targeted by a SimpleMegaMenuType entity. Otherwise, FALSE.
Overrides SimpleMegaMenuHelperInterface::menuIsTargetedByMegaMenuType
File
- src/
SimpleMegaMenuHelper.php, line 58
Class
- SimpleMegaMenuHelper
- Class SimpleMegaMenuHelper.
Namespace
Drupal\simple_megamenuCode
public function menuIsTargetedByMegaMenuType($menu_name) {
$simple_mega_menu_types = $this->entityTypeManager
->getStorage('simple_mega_menu_type')
->loadMultiple();
/** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuType $entity */
foreach ($simple_mega_menu_types as $entity) {
$target_menus = $this
->getTargetMenus($entity);
if (in_array($menu_name, $target_menus)) {
return TRUE;
}
}
return FALSE;
}