CMSMenu
class CMSMenu implements IteratorAggregate, i18nEntityProvider
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
at line 63
static
populate_menu()
Generate CMS main menu items by collecting valid subclasses of {@link LeftAndMain}
at line 75
static
add_controller(string $controllerClass)
Add a LeftAndMain controller to the CMS menu.
at line 125
static boolean
add_link(string $code, string $menuTitle, string $url, integer $priority = -1, array $attributes = null, string $iconClass = null)
Add an arbitrary URL to the CMS menu.
at line 148
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}
at line 179
static array
get_menu_item(string $code)
Get a single menu item by its code value.
at line 191
static string
get_menu_code(string $cmsClass)
Get menu code for class
at line 201
static array
get_menu_items()
Get all menu entries.
at line 252
static array
get_viewable_menu_items(Member $member = null)
Get all menu items that the passed member can view.
Defaults to {@link Security::getCurrentUser()}.
at line 288
static
remove_menu_item(string $code)
Removes an existing item from the menu.
at line 298
static
remove_menu_class(string $className)
Remove menu item by class name.
at line 307
static
clear_menu()
Clears the entire menu
at line 330
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.
at line 379
static array
get_cms_classes(string $root = null, boolean $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.
at line 419
getIterator()
IteratorAggregate Interface Method. Iterates over the menu items.
at line 427
array
provideI18nEntities()
Provide menu titles to the i18n entity provider