Fixes #16 - Adds tooltip to counter in navigation using 'counterLabel' property

This commit is contained in:
Sam Georges 2014-11-10 20:33:43 +11:00
parent cbf49e294f
commit 7bcec1bd99
2 changed files with 9 additions and 6 deletions

View File

@ -46,6 +46,7 @@ class NavigationManager
'icon' => null,
'url' => null,
'counter' => null,
'counterLabel'=> null,
'attributes' => [],
'permissions' => []
];
@ -159,6 +160,7 @@ class NavigationManager
* - permissions - an array of permissions the back-end user should have, optional.
* - counter - an optional numeric value to output near the menu icon. The value should be
* a number or a callable returning a number.
* - counterLabel - an optional string value to describe the numeric reference in counter.
* @param string $owner Specifies the menu items owner plugin or module in the format Author.Plugin.
* @param array $definitions An array of the menu item definitions.
*/

View File

@ -1,13 +1,13 @@
<?php
$context = BackendMenu::getContext();
$contextSidenav = BackendMenu::getContextSidenavPartial($context->owner, $context->mainMenuCode);
if (!$contextSidenav):
$sideMenuItems = BackendMenu::listSideMenuItems();
if ($sideMenuItems):
?>
<div class="layout-cell width-120" >
<?php if (!$contextSidenav): ?>
<?php
$sideMenuItems = BackendMenu::listSideMenuItems();
?>
<?php if ($sideMenuItems): ?>
<div class="layout-cell width-120">
<div class="layout-relative">
<nav class="layout-sidenav" id="layout-sidenav" data-control="sidenav">
<ul class="nav">
@ -22,6 +22,7 @@
<span
class="counter <?= $item->counter === null ? 'empty' : null ?>"
data-menu-id="<?= e($context->mainMenuCode.'/'.$sideItemCode) ?>"
<?php if ($item->counterLabel): ?>title="<?= e(trans($item->counterLabel)) ?>"<?php endif ?>
>
<?= e($item->counter) ?>
</span>