80 lines
3.3 KiB
PHTML
80 lines
3.3 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var string $renderedHtml Rendered markdown HTML
|
|
* @var array<int, array<string, mixed>> $tocItems TOC headings [{level, text, anchor}]
|
|
* @var array<string, array<string, string>> $docGroups Grouped doc navigation
|
|
* @var string $currentSlug Active slug
|
|
* @var string $currentTitle Active doc title
|
|
* @var string $defaultSlug Default docs slug from catalog order
|
|
*/
|
|
?>
|
|
|
|
<div class="app-docs-container">
|
|
|
|
<aside class="app-docs-nav" aria-label="<?php e(t('Documentation navigation')); ?>">
|
|
<nav data-details-storage="admin-docs-nav-groups-v1">
|
|
<?php $groupIndex = 0; ?>
|
|
<?php foreach ($docGroups as $groupLabel => $items): ?>
|
|
<?php
|
|
$groupKey = 'docs-nav-group-' . ((string) (array_key_first($items) ?? $groupIndex));
|
|
$groupOpen = array_key_exists($currentSlug, $items);
|
|
$groupIndex++;
|
|
?>
|
|
<div class="app-docs-nav-group">
|
|
<details data-details-key="<?php e($groupKey); ?>" <?php if ($groupOpen): ?>open<?php endif; ?>>
|
|
<summary><small class="muted"><?php e($groupLabel); ?></small></summary>
|
|
<ul>
|
|
<?php foreach ($items as $docSlug => $label): ?>
|
|
<?php $isActive = $docSlug === $currentSlug; ?>
|
|
<li>
|
|
<a href="<?php e(lurl('admin/docs/' . $docSlug)); ?>"
|
|
class="<?php e($isActive ? 'active' : ''); ?>"
|
|
<?php if ($isActive): ?>aria-current="page" <?php endif; ?>>
|
|
<?php e($label); ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
<hr>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</nav>
|
|
</aside>
|
|
|
|
<article class="app-docs-content">
|
|
<?php
|
|
$breadcrumbs = [
|
|
['label' => t('Home'), 'path' => 'admin'],
|
|
['label' => t('Documentation'), 'path' => 'admin/docs/' . $defaultSlug],
|
|
['label' => $currentTitle],
|
|
];
|
|
require templatePath('partials/app-breadcrumb.phtml');
|
|
?>
|
|
<?php MintyPHP\Buffer::get('docs_rendered_html'); ?>
|
|
</article>
|
|
|
|
<?php if ($tocItems): ?>
|
|
<aside class="app-docs-toc" aria-label="<?php e(t('On this page')); ?>">
|
|
<small class="muted"><?php e(t('On this page')); ?></small>
|
|
<ul>
|
|
<?php foreach ($tocItems as $item): ?>
|
|
<li class="app-docs-toc-level-<?php e((string) $item['level']); ?>">
|
|
<a href="<?php e(lurl('admin/docs/' . $currentSlug) . '#' . $item['anchor']); ?>"><?php e($item['text']); ?></a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</aside>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
window.addEventListener('DOMContentLoaded', function () {
|
|
document.querySelectorAll('.app-docs-content li > input[type="checkbox"][disabled]').forEach(function (checkbox) {
|
|
checkbox.removeAttribute('disabled');
|
|
});
|
|
});
|
|
</script>
|