Skip to content
alinistrate edited this page Nov 27, 2026 · 1 revision

From Olive Menus 5.1, project modules and plugins can register Craft element types as menu link sources.

Register a listener during module or plugin initialization. Map the element class to the label editors should see in Add menu items.

use myproject\elements\Location;
use olivestudio\olivemenus\events\RegisterMenuElementTypesEvent;
use olivestudio\olivemenus\services\OlivemenusService;
use yii\base\Event;

Event::on(
    OlivemenusService::class,
    OlivemenusService::EVENT_REGISTER_MENU_ELEMENT_TYPES,
    static function (RegisterMenuElementTypesEvent $event): void {
        $event->types[Location::class] = 'Locations';
    },
);

The class must implement Craft's ElementInterface. Elements need a public URL to render as links. Test the selector and frontend output on each site where editors will use the element type.

Clone this wiki locally