aboutsummaryrefslogtreecommitdiff
path: root/templates/header-navigation-item.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /templates/header-navigation-item.php
current code from svn, revision 62608
Diffstat (limited to 'templates/header-navigation-item.php')
-rw-r--r--templates/header-navigation-item.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/header-navigation-item.php b/templates/header-navigation-item.php
new file mode 100644
index 0000000..9b2157c
--- /dev/null
+++ b/templates/header-navigation-item.php
@@ -0,0 +1,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>