Piwik\Menu\
Contains menu entries for the Admin menu.
Plugins can implement the configureAdminMenu()
method of the Menu
plugin class to add, rename of remove
items. If your plugin does not have a Menu
class yet you can create one using ./console generate:menu
.
The class defines the following methods:
getInstance()
ash; Returns the singleton instance for the derived class. Inherited from Singleton
addItem()
ash; Adds a new entry to the menu. Inherited from MenuAbstract
remove()
ash; Removes an existing entry from the menu. Inherited from MenuAbstract
rename()
ash; Renames a single menu entry. Inherited from MenuAbstract
editUrl()
ash; Edits a URL of an existing menu entry. Inherited from MenuAbstract
addPersonalItem()
— See add().addDevelopmentItem()
— See add().addDiagnosticItem()
— See add().addPlatformItem()
— See add().addPluginItem()
— See add().addMeasurableItem()
— See add().addSystemItem()
— See add().getInstance()
Returns the singleton instance for the derived class. If the singleton instance has not been created, this method will create it.
Singleton
value.addItem()
Since Matomo 2.7.0
Adds a new entry to the menu.
$menuName
(string
) —
The menu's category name. Can be a translation token.$subMenuName
(string
) —
The menu item's name. Can be a translation token.$url
(string
|array
) —
The URL the admin menu entry should link to, or an array of query parameters that can be used to build the URL.$order
(int
) —
The order hint.$tooltip
(bool
|string
) —
An optional tooltip to display or false to display the tooltip.$icon
(bool
|string
) —
An icon classname, such as "icon-add". Only supported by admin menu$onclick
(bool
|string
) —
Will execute the on click handler instead of executing the link. Only supported by admin menu.$attribute
(string
) —
Will add this string as a link attribute.$help
(bool
|string
) —
Will display a help icon that will pop a notification with help information.$badgeCount
(int
) —
If non-zero then a badge will be overlaid on the icon showing the provided countremove()
Removes an existing entry from the menu.
$menuName
(string
) —
The menu's category name. Can be a translation token.$subMenuName
(bool
|string
) —
The menu item's name. Can be a translation token.rename()
Renames a single menu entry.
It accepts the following parameter(s):
$mainMenuOriginal
$subMenuOriginal
$mainMenuRenamed
$subMenuRenamed
It does not return anything or a mixed result.
editUrl()
Edits a URL of an existing menu entry.
It accepts the following parameter(s):
$mainMenuToEdit
$subMenuToEdit
$newUrl
It does not return anything or a mixed result.
addPersonalItem()
Since Matomo 2.5.0
See add(). Adds a new menu item to the manage section of the user menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addDevelopmentItem()
Since Matomo 2.5.0
See add(). Adds a new menu item to the development section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addDiagnosticItem()
Since Matomo 2.5.0
See add(). Adds a new menu item to the diagnostic section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addPlatformItem()
Since Matomo 2.5.0
See add(). Adds a new menu item to the platform section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addPluginItem()
Since Matomo 5.0.0
See add(). Adds a new menu item to the plugins section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addMeasurableItem()
Since Matomo 3.0.0
See add(). Adds a new menu item to the measurable section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.
addSystemItem()
Since Matomo 3.0.0
See add(). Adds a new menu item to the manage section of the admin menu.
It accepts the following parameter(s):
$menuName
(string
) —
$url
(array
) —
$order
(int
) —
$tooltip
(bool
|string
) —
It does not return anything or a mixed result.