ConfigureMenuEvent
ConfigureMenuEvent.php
:
62
Extends Event
Event allowing to customize build-in menus.
Storefront menus are based on the and are easily extensible via event subscribers. You can listen to the following events:
-
ibexa.storefront.breadcrumbs.configure.tree_root
-
ibexa.storefront.breadcrumbs.configure.taxonomy_entry
-
ibexa.storefront.breadcrumbs.configure.product
-
ibexa.storefront.breadcrumbs.configure.user_setting
-
ibexa.storefront.breadcrumbs.configure.user_settings_group
-
ibexa.storefront.currency_menu.configure
-
ibexa.storefront.taxonomy_menu.configure
-
ibexa.storefront.user_menu.configure
-
ibexa.storefront.language_menu.configure
-
ibexa.storefront.region_menu.configure
The example belows shows how to append link to "All entries" to taxonomy menu:
namespace App\EventSubscriber;
use Ibexa\Contracts\Storefront\Menu\Event\ConfigureMenuEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final readonly class TaxonomyMenuSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
'ibexa.storefront.taxonomy_menu.configure' => 'onMenuConfigure',
];
}
public function onMenuConfigure(ConfigureMenuEvent $event): void
{
$menu = $event->getMenu();
$menu->addChild(
'all_categories',
[
'label' => 'All categories',
// ... other options
],
);
}
}
Methods¶
__construct() ¶
ConfigureMenuEvent.php
:
72
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$menu | ItemInterface | - | - |
$options | array<string, mixed> | [] | - |
getMenu() ¶
ConfigureMenuEvent.php
:
78
|
|
Return values
ItemInterface
getOptions() ¶
ConfigureMenuEvent.php
:
86
|
|
Return values
array<string, mixed>