CMSMenu
class CMSMenu implements IteratorAggregate, i18nEntityProvider (View source)
The object manages the main CMS menu. See {@link LeftAndMain::init()} for example usage.
The menu will be automatically populated with menu items for subclasses of {@link LeftAndMain}. That is, for each class in the CMS that creates an administration panel, a CMS menu item will be created. The default configuration will also include a 'help' link to the SilverStripe user documentation.
Additional CMSMenu items can be added through {@link LeftAndMainExtension::init()} extensions added to {@link LeftAndMain}.
Constants
MENU_PRIORITY |
Sort by menu priority, highest to lowest |
URL_PRIORITY |
Sort by url priority, highest to lowest |
Methods
Generate CMS main menu items by collecting valid subclasses of {@link LeftAndMain}
Add a LeftAndMain controller to the CMS menu.
Add an arbitrary URL to the CMS menu.
Add a navigation item to the main administration menu showing in the top bar.
Get a single menu item by its code value.
Get menu code for class
Get all menu entries.
Removes an existing item from the menu.
Remove menu item by class name.
Clears the entire menu
Replace a navigation item to the main administration menu showing in the top bar.
A utility funciton to retrieve subclasses of a given class that are instantiable (ie, not abstract) and have a valid menu title.
IteratorAggregate Interface Method. Iterates over the menu items.
Provide menu titles to the i18n entity provider
Details
static
populate_menu()
Generate CMS main menu items by collecting valid subclasses of {@link LeftAndMain}
static
add_controller(string $controllerClass)
Add a LeftAndMain controller to the CMS menu.
static bool
add_link(string $code, string $menuTitle, string $url, int $priority = -1, array $attributes = null, string $iconClass = null)
Add an arbitrary URL to the CMS menu.
static bool
add_menu_item(string $code, string $menuTitle, string $url, string $controllerClass = null, int $priority = -1, array $attributes = null, string $iconClass = null)
Add a navigation item to the main administration menu showing in the top bar.
uses {@link CMSMenu::$menu_items}
static array
get_menu_item(string $code)
Get a single menu item by its code value.
static string
get_menu_code(string $cmsClass)
Get menu code for class
static array
get_menu_items()
Get all menu entries.
static array
get_viewable_menu_items(Member $member = null)
Get all menu items that the passed member can view.
Defaults to {@link Security::getCurrentUser()}.
static
remove_menu_item(string $code)
Removes an existing item from the menu.
static
remove_menu_class(string $className)
Remove menu item by class name.
static
clear_menu()
Clears the entire menu
static bool
replace_menu_item(string $code, string $menuTitle, string $url, string $controllerClass = null, int $priority = -1, array $attributes = null, string $iconClass = null)
Replace a navigation item to the main administration menu showing in the top bar.
static array
get_cms_classes(string $root = null, bool $recursive = true, string $sort = self::MENU_PRIORITY)
A utility funciton to retrieve subclasses of a given class that are instantiable (ie, not abstract) and have a valid menu title.
Sorted by url_priority config.
getIterator()
IteratorAggregate Interface Method. Iterates over the menu items.
array
provideI18nEntities()
Provide menu titles to the i18n entity provider