Piwik\Menu\MenuAbstract::addItem PHP Method

addItem() public method

Adds a new entry to the menu.
Since: 2.7.0
public addItem ( string $menuName, string $subMenuName, string | array $url, integer $order = 50, boolean | string $tooltip = false )
$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 integer The order hint.
$tooltip boolean | string An optional tooltip to display or false to display the tooltip.
    public function addItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false)
    {
        // make sure the idSite value used is numeric (hack-y fix for #3426)
        if (isset($url['idSite']) && !is_numeric($url['idSite'])) {
            $idSites = API::getInstance()->getSitesIdWithAtLeastViewAccess();
            $url['idSite'] = reset($idSites);
        }
        $this->menuEntries[] = array($menuName, $subMenuName, $url, $order, $tooltip);
    }