32 lines
918 B
PHTML
32 lines
918 B
PHTML
<?php
|
|
$breadcrumbs = $breadcrumbs ?? [];
|
|
$items = array_values(array_filter($breadcrumbs, static function ($item) {
|
|
return !empty($item['label']);
|
|
}));
|
|
if (!$items) {
|
|
return;
|
|
}
|
|
$lastIndex = count($items) - 1;
|
|
?>
|
|
<div class="app-breadcrumb">
|
|
<?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);
|
|
}
|
|
?>
|
|
<?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; ?>
|
|
<?php if (!$isLast): ?>
|
|
<i class="bi bi-chevron-right"></i>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|