Files
breadcrumb-the-shire/modules/help-center/templates/aside-help-panel.phtml
fs 304924368b fix(help-center): replace inline content with standard navigation panel
Rewrite help panel to use the same grouped navigation pattern as the
admin aside panel (details/summary with nav links). Remove inline
keyboard shortcuts table and about section. Panel now shows
permission-gated navigation groups: Documentation (docs viewer, API
docs) and System (system info). Remove custom CSS — panel inherits
existing app-sidebar-admin-nav styling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:25:01 +01:00

78 lines
2.7 KiB
PHTML

<?php
use MintyPHP\Service\Docs\DocsCatalogService;
$layoutAuth = is_array($viewAuth['layout'] ?? null) ? $viewAuth['layout'] : [];
$canViewDocs = !empty($layoutAuth['can_view_docs']);
$canViewApiDocs = !empty($layoutAuth['api_docs.view']);
$canViewSystemInfo = !empty($layoutAuth['can_view_system_info']);
$docsDefaultSlug = $canViewDocs ? DocsCatalogService::defaultSlug() : '';
$helpNavGroups = [
[
'key' => 'help-documentation',
'label' => t('Documentation'),
'icon' => 'bi-book',
'items' => [
[
'label' => t('Documentation'),
'path' => $docsDefaultSlug !== '' ? 'admin/docs/' . $docsDefaultSlug : '',
'active' => navActive('admin/docs', true),
'visible' => $canViewDocs && $docsDefaultSlug !== '',
],
[
'label' => t('API docs'),
'path' => 'admin/api-docs',
'active' => navActive('admin/api-docs', true),
'visible' => $canViewApiDocs,
],
],
],
[
'key' => 'help-system',
'label' => t('System'),
'icon' => 'bi-info-circle',
'items' => [
[
'label' => t('System info'),
'path' => 'admin/system-info',
'active' => navActive('admin/system-info', true),
'visible' => $canViewSystemInfo,
],
],
],
];
?>
<ul class="app-sidebar-admin-nav" aria-label="<?php e(t('Help')); ?>">
<?php foreach ($helpNavGroups as $group):
$items = array_values(array_filter($group['items'], static fn ($item) => !empty($item['visible'])));
if (!$items) { continue; }
$groupIsActive = false;
foreach ($items as $item) {
$activeState = $item['active'] ?? [];
if (!empty($activeState['isActive'])) { $groupIsActive = true; break; }
}
?>
<li class="app-sidebar-group app-sidebar-admin-group">
<details data-details-key="<?php e($group['key']); ?>"<?php if ($groupIsActive): ?> open<?php endif; ?>>
<summary>
<i class="bi <?php e($group['icon']); ?>"></i>
<span><?php e($group['label']); ?></span>
</summary>
<ul>
<?php foreach ($items as $item):
$active = $item['active'] ?? ['class' => '', 'aria' => ''];
?>
<li>
<a href="<?php e(lurl($item['path'])); ?>" class="<?php e($active['class'] ?? ''); ?>" <?php echo $active['aria'] ?? ''; ?>>
<?php e($item['label']); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</details>
</li>
<?php endforeach; ?>
</ul>