aboutsummaryrefslogtreecommitdiff
path: root/templates/header-navigation-item.php
blob: 9b2157cdb3200e8c1bbab1afc444c0d7329694d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$attributes = $nav->getLinkAttributes();

$image_attributes = $nav->getImage()->getAttributes();
$attributes['title'] = $image_attributes['title'];

if ($accesskey_enabled) {
    if (!isset($GLOBALS['accesskey-count'])) {
        $GLOBALS['accesskey-count'] = 1;
    }

    if ($GLOBALS['accesskey-count'] < 10) {
        $attributes['title'] = "{$attributes['title']}  [ALT] + {$GLOBALS['accesskey-count']}";
        $attributes['accesskey'] = $GLOBALS['accesskey-count']++;
    }
}

// Add badge number to link attributes
if ($nav->getBadgeNumber()) {
    $attributes['data-badge'] = (int)$nav->getBadgeNumber();
}

// Convert link attributes array to proper attribute string
$attr_str = arrayToHtmlAttributes($attributes);
?>

<li id="nav_<?= $path ?>"<? if ($nav->isActive()) : ?> class="active"<? endif ?>>
    <a href="<?= URLHelper::getLink($nav->getURL(), $link_params) ?>" <?= $attr_str ?>>
        <?= $nav->getImage()->asImg(['class' => 'headericon original', 'title' => null]) ?>
        <div class="navtitle"><?= htmlReady($nav->getTitle()) ?></div>
    </a>
</li>