Created
March 29, 2016 10:58
-
-
Save DuaelFr/8fac42faa95d2c567470 to your computer and use it in GitHub Desktop.
D8 menu item expanded by default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_ENTITY_TYPE_presave(). | |
* | |
* Force the expanded state on menu items in the main menu. | |
*/ | |
function MYMODULE_menu_link_content_presave(MenuLinkContentInterface $entity) { | |
if ($entity->get('menu_name')->value == 'main') { | |
$entity->get('expanded')->set(0, TRUE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment