Files
luxtools-template/tpl_pagetools.php
2026-01-30 13:45:26 +01:00

54 lines
1.9 KiB
PHP

<?php
/**
* Template partial for rendering page tools as a status bar
*
* This displays the page menu items in a TurboVision-style status bar
* at the bottom of the page with prominent accesskey display.
*
* @var string $menuClass The menu class to use (defaults to \dokuwiki\Menu\PageMenu)
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
// Determine which menu to use (PageMenu for main.php, DetailMenu for detail.php)
$menuClass = $menuClass ?? \dokuwiki\Menu\PageMenu::class;
try {
$menu = new $menuClass();
$items = $menu->getItems();
} catch (Exception $e) {
$items = [];
}
if (empty($items)) return;
?>
<nav id="dokuwiki__pagetools" class="pagetools-statusbar" aria-labelledby="dokuwiki__pagetools__heading">
<h3 class="a11y" id="dokuwiki__pagetools__heading"><?php echo $lang['page_tools']; ?></h3>
<ul>
<?php foreach ($items as $item): ?>
<?php
$accesskey = $item->getAccesskey();
$label = hsc($item->getLabel());
$title = hsc($item->getTitle());
$link = $item->getLink();
$type = $item->getType();
$nofollow = $item->isNofollow() ? ' rel="nofollow"' : '';
?>
<li class="action <?php echo $type; ?>">
<a href="<?php echo $link; ?>"
title="<?php echo $title; ?><?php echo $accesskey ? ' [' . $accesskey . ']' : ''; ?>"
<?php echo $accesskey ? 'accesskey="' . $accesskey . '"' : ''; ?>
<?php echo $nofollow; ?>>
<?php if ($accesskey): ?>
<span class="accesskey"><?php echo strtoupper(hsc($accesskey)); ?></span>
<?php endif; ?>
<span class="label"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</nav>