25 lines
727 B
PHP
25 lines
727 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/** @var array<int, array<string, mixed>> $items */
|
|
/** @var int $depth */
|
|
?>
|
|
<ul class="category-list depth-<?= e((string) $depth) ?>">
|
|
<?php foreach ($items as $category): ?>
|
|
<li>
|
|
<a href="/catalog/<?= e($category['slug']) ?>"><?= e($category['name']) ?></a>
|
|
<?php if (!empty($category['children'])): ?>
|
|
<?php
|
|
$previousItems = $items;
|
|
$items = $category['children'];
|
|
$depth++;
|
|
require __DIR__ . '/category-tree.php';
|
|
$depth--;
|
|
$items = $previousItems;
|
|
?>
|
|
<?php endif; ?>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|