新增维护页和自定义 404,扩充模板并提供 MCP Skill #8
@@ -4,6 +4,7 @@ use App\Content\SystemPage;
|
|||||||
use App\Content\View;
|
use App\Content\View;
|
||||||
|
|
||||||
$e = View::escape(...);
|
$e = View::escape(...);
|
||||||
|
$pageTypeLabels = LayoutPage::TYPES + SystemPage::TYPES;
|
||||||
$regular = array_filter($pages, static fn (array $page): bool => $page['layout_kind'] === null && $page['page_type'] === 'page');
|
$regular = array_filter($pages, static fn (array $page): bool => $page['layout_kind'] === null && $page['page_type'] === 'page');
|
||||||
$live = count(array_filter($regular, static fn (array $page): bool => $page['status'] === 'published'));
|
$live = count(array_filter($regular, static fn (array $page): bool => $page['status'] === 'published'));
|
||||||
$defaultSlugs = [];
|
$defaultSlugs = [];
|
||||||
@@ -44,14 +45,14 @@ foreach (['header', 'footer'] as $kind) {
|
|||||||
<?php
|
<?php
|
||||||
$type = $page['page_type'];
|
$type = $page['page_type'];
|
||||||
$kind = $page['layout_kind'] ?? (isset(SystemPage::TYPES[$type]) ? $type : null);
|
$kind = $page['layout_kind'] ?? (isset(SystemPage::TYPES[$type]) ? $type : null);
|
||||||
$label = (LayoutPage::TYPES + SystemPage::TYPES)[$kind] ?? '';
|
$label = $kind === null ? '' : ($pageTypeLabels[$kind] ?? '');
|
||||||
$path = $page['slug'] === 'home' ? '/' : '/' . $page['slug'];
|
$path = $page['slug'] === 'home' ? '/' : '/' . $page['slug'];
|
||||||
$published = $page['status'] === 'published';
|
$published = $page['status'] === 'published';
|
||||||
$public = $kind === null && $published;
|
$public = $kind === null && $published;
|
||||||
?>
|
?>
|
||||||
<li data-page-item="<?= $e($kind ?? $page['status']) ?>" data-page-label="<?= $e($page['name'] . ' ' . $page['title'] . ' ' . ($kind ? $label : $path)) ?>">
|
<li data-page-item="<?= $e($kind ?? $page['status']) ?>" data-page-label="<?= $e($page['name'] . ' ' . $page['title'] . ' ' . ($kind ? $label : $path)) ?>">
|
||||||
<div class="dashboard-page-label"><strong><?= $e($page['name']) ?></strong>
|
<div class="dashboard-page-label"><strong><?= $e($page['name']) ?></strong>
|
||||||
<?php if (!$kind): ?><small><?= $e($path) ?></small>
|
<?php if ($kind === null): ?><small><?= $e($path) ?></small>
|
||||||
<?php elseif (($defaultSlugs[$kind] ?? null) === $page['slug']): ?><small>站点默认</small>
|
<?php elseif (($defaultSlugs[$kind] ?? null) === $page['slug']): ?><small>站点默认</small>
|
||||||
<?php elseif (($site['system_pages'][$kind] ?? null) === $page['slug']): ?><small><?= $kind === 'maintenance' ? ($site['maintenance_enabled'] ? '维护模式已开启' : '已选作维护页') : '已启用为 404 页' ?></small><?php endif ?>
|
<?php elseif (($site['system_pages'][$kind] ?? null) === $page['slug']): ?><small><?= $kind === 'maintenance' ? ($site['maintenance_enabled'] ? '维护模式已开启' : '已选作维护页') : '已启用为 404 页' ?></small><?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user