Menu Hooks

Menu Module


The menu module comes with the following hooks. You can hook into those using the usual listener logic.

Please view the hook section in the Core module.

MenuIsCreating

MenuIsUpdating

The MenuIsUpdating has one more method:

  • getMenu(): Will return the menu being updated

MenuIsCreating Example

To keep the example simple we're going to use an inline listener using a closure instead of a full class.

Lets say you want to make the menu name lowercase:

Event::listen(MenuIsCreating::class, function (MenuIsCreating $event) {
    $event->setAttributes(['name' => strtolower($event->getAttribute('name'))]);
});

MenuItemIsCreating

MenuItemIsUpdating

The MenuItemIsUpdating has one more method:

  • getMenuItem(): Will return the menu item being updated

Mobile Analytics