forked from fa/breadcrumb-the-shire
Move breadcrumb rendering from individual page templates into the core topbar. Each page now sets $breadcrumbs in its action .php file; the topbar renders it automatically via the shared partial. - Remove global back/forward buttons and app-nav-history.js component - Remove Alt+Arrow keyboard shortcuts for history navigation - Render breadcrumb in topbar-left section (replaces button area) - Clean up breadcrumb CSS: context-neutral base (flex, no margin) - Recalculate sticky titlebar offset in details container - Migrate all 41 pages (core + helpdesk, audit, addressbook, api-docs) - Add missing breadcrumbs to addressbook detail view - Update architecture contract tests (nav-history references removed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
921 B
PHTML
32 lines
921 B
PHTML
<?php
|
|
$items = array_values(array_filter($breadcrumbs ?? [], static function ($item) {
|
|
return !empty($item['label']);
|
|
}));
|
|
if (!$items) {
|
|
return;
|
|
}
|
|
$lastIndex = count($items) - 1;
|
|
?>
|
|
<nav class="app-breadcrumb" aria-label="<?php e(t('Breadcrumb')); ?>">
|
|
<ol>
|
|
<?php foreach ($items as $index => $item): ?>
|
|
<?php
|
|
$label = (string) ($item['label'] ?? '');
|
|
$href = (string) ($item['href'] ?? '');
|
|
$path = (string) ($item['path'] ?? '');
|
|
$isLast = $index === $lastIndex;
|
|
if ($href === '' && $path !== '') {
|
|
$href = lurl($path);
|
|
}
|
|
?>
|
|
<li>
|
|
<?php if ($href !== '' && !$isLast): ?>
|
|
<a href="<?php e($href); ?>"><?php e($label); ?></a>
|
|
<?php else: ?>
|
|
<span<?php if ($isLast): ?> aria-current="page"<?php endif; ?>><?php e($label); ?></span>
|
|
<?php endif; ?>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ol>
|
|
</nav>
|