Edit shared headers and footers as page types
This commit is contained in:
@@ -10,8 +10,11 @@ final class PageDraft
|
||||
{
|
||||
public const RESERVED = ['admin', 'assets', 'home', 'account', 'mcp', 'palette'];
|
||||
|
||||
public static function slug(mixed $value, array $reserved = self::RESERVED): string
|
||||
public static function slug(mixed $value, array $reserved = self::RESERVED, bool $includeLayouts = false): string
|
||||
{
|
||||
if ($includeLayouts && is_string($value) && preg_match('/^layout--(?:header|footer)-[1-9][0-9]{0,18}$/D', $value)) {
|
||||
return $value;
|
||||
}
|
||||
if (!is_string($value) || strlen($value) > 70 || !preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/D', $value)
|
||||
|| in_array($value, $reserved, true)) {
|
||||
throw new RuntimeException('网址标识无效或已保留。');
|
||||
@@ -92,7 +95,7 @@ final class PageDraft
|
||||
}
|
||||
}
|
||||
$style = $item['style'] ?? $preset[4] ?? 'plain';
|
||||
if (!in_array($style, ['plain', 'tinted'], true)) {
|
||||
if (!in_array($style, ['plain', 'tinted', 'layout'], true)) {
|
||||
throw new RuntimeException('区块样式无效。');
|
||||
}
|
||||
$sections[$key] = [
|
||||
|
||||
Reference in New Issue
Block a user