Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Menu/MenuAbstract.php')
-rw-r--r--core/Menu/MenuAbstract.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php
index 7651a1199d..777d97b523 100644
--- a/core/Menu/MenuAbstract.php
+++ b/core/Menu/MenuAbstract.php
@@ -30,6 +30,7 @@ abstract class MenuAbstract extends Singleton
protected $edits = array();
protected $renames = array();
protected $orderingApplied = false;
+ protected $menuIcons = array();
protected static $menus = array();
/**
@@ -49,6 +50,17 @@ abstract class MenuAbstract extends Singleton
}
/**
+ * Let's you register a menu icon for a certain menu category to replace the default arrow icon.
+ *
+ * @param string $menuName The translation key of a main menu category, eg 'Dashboard_Dashboard'
+ * @param string $iconCssClass The css class name of an icon, eg 'icon-user'
+ */
+ public function registerMenuIcon($menuName, $iconCssClass)
+ {
+ $this->menuIcons[$menuName] = $iconCssClass;
+ }
+
+ /**
* Returns a list of available plugin menu instances.
*
* @return \Piwik\Plugin\Menu[]
@@ -164,6 +176,11 @@ abstract class MenuAbstract extends Singleton
$this->menu[$menuName]['_order'] = $order;
$this->menu[$menuName]['_name'] = $menuName;
$this->menu[$menuName]['_tooltip'] = $tooltip;
+ if (!empty($this->menuIcons[$menuName])) {
+ $this->menu[$menuName]['_icon'] = $this->menuIcons[$menuName];
+ } else {
+ $this->menu[$menuName]['_icon'] = '';
+ }
}
if (!empty($subMenuName)) {
$this->menu[$menuName][$subMenuName]['_url'] = $url;