ExpressionEngine® User Guide

Legacy Documentation

You are using the documentation for version 4.3.8. Go here for the latest version.

Control Panel Menu Extension Hooks

cp_custom_menu

cp_custom_menu($menu)

Add menu items to the secondary navigation area specifically reserved for custom links.

How it’s called:

ee()->extensions->call('cp_custom_menu', $menu);

The $menu object is of type EllisLab\ExpressionEngine\Service\CustomMenu\Menu and implements the following API:

// call addItem to create a link in this menu
$menu->addItem('Title', ee('CP/URL')->make('addons/settings/myaddon'));

// call addSubmenu to create a dropdown menu
// this returns a submenu object
$sub = $menu->addSubmenu('Title');

The submenu object is of type EllisLab\ExpressionEngine\Service\CustomMenu\Submenu and implements the following API:

// call addItem to create a link in this menu
$sub->addItem('Title', ee('CP/URL')->make('addons/settings/myaddon'));

// call withAddLink to add a new/create link to the menu
$sub->withAddLink('Title', ee('CP/URL')->make('addons/settings/myaddon/create'));

// call withFilter to add a create fuzzy filter searchbox inside the menu
// the first and only parameter is the input's placeholder text
$sub->withFilter('find entries ...');

New in version 3.4.0.