Files
breadcrumb-the-shire/modules/help-center/templates/aside-help-panel.phtml

66 lines
2.3 KiB
PHTML
Raw Normal View History

<?php
use MintyPHP\Service\Docs\DocsCatalogService;
use MintyPHP\Service\Ui\HotkeyService;
$layoutAuth = is_array($viewAuth['layout'] ?? null) ? $viewAuth['layout'] : [];
$canViewDocs = !empty($layoutAuth['can_view_docs']);
$canViewApiDocs = !empty($layoutAuth['api_docs.view']);
$hasDocumentation = $canViewDocs || $canViewApiDocs;
$docsDefaultSlug = $canViewDocs ? DocsCatalogService::defaultSlug() : '';
$docsUrl = $docsDefaultSlug !== '' ? lurl('admin/docs/' . $docsDefaultSlug) : '';
$apiDocsUrl = $canViewApiDocs ? lurl('admin/api-docs') : '';
$isMac = str_contains(strtolower((string) ($_SERVER['HTTP_USER_AGENT'] ?? '')), 'mac');
$hotkeys = HotkeyService::list();
?>
<div class="app-help-panel">
<?php if ($hasDocumentation): ?>
<div class="app-sidebar-group">
<h3 class="app-sidebar-title"><?php e(t('Documentation')); ?></h3>
<ul>
<?php if ($canViewDocs && $docsUrl !== ''): ?>
<li><a href="<?php e($docsUrl); ?>"><i class="bi bi-book"></i> <?php e(t('Documentation')); ?></a></li>
<?php endif; ?>
<?php if ($canViewApiDocs): ?>
<li><a href="<?php e($apiDocsUrl); ?>"><i class="bi bi-braces"></i> <?php e(t('API docs')); ?></a></li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<div class="app-sidebar-group">
<h3 class="app-sidebar-title"><?php e(t('Keyboard shortcuts')); ?></h3>
<table class="app-help-shortcuts-table" role="grid">
<thead>
<tr>
<th scope="col"><?php e(t('Action')); ?></th>
<th scope="col"><?php e(t('Shortcut')); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($hotkeys as $hotkey):
$shortcut = $isMac ? ($hotkey['mac'] ?? '') : ($hotkey['win'] ?? '');
$action = t($hotkey['action_key'] ?? '');
?>
<tr>
<td><?php e($action); ?></td>
<td><kbd><?php e($shortcut); ?></kbd></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="app-sidebar-group">
<h3 class="app-sidebar-title"><?php e(t('About')); ?></h3>
<ul>
<li class="app-help-about-item">
<span class="app-help-about-label"><?php e(t('Application')); ?></span>
<span class="app-help-about-value"><?php e(t('CoreCore Admin')); ?></span>
</li>
</ul>
</div>
</div>