feat: 插件/主题管理卡片改用 Filament 原生组件+中文页面标题;注入点分三组管理(页面/侧边栏/文章);前台 sablog 主题全面语义化(header/nav/main/aside/section/footer)
This commit is contained in:
@@ -26,6 +26,8 @@ class BlogSettings extends Page
|
||||
|
||||
protected static ?string $navigationLabel = '博客设置';
|
||||
|
||||
protected static ?string $title = '博客设置';
|
||||
|
||||
protected string $view = 'filament.pages.blog-settings';
|
||||
|
||||
public array $data = [];
|
||||
|
||||
@@ -23,6 +23,8 @@ class Plugins extends Page
|
||||
|
||||
protected static ?string $navigationLabel = '插件管理';
|
||||
|
||||
protected static ?string $title = '插件管理';
|
||||
|
||||
protected string $view = 'filament.pages.plugins';
|
||||
|
||||
public $zip;
|
||||
|
||||
@@ -30,6 +30,8 @@ class ThemeInject extends Page
|
||||
|
||||
protected static ?string $navigationLabel = '主题注入';
|
||||
|
||||
protected static ?string $title = '主题注入';
|
||||
|
||||
protected string $view = 'filament.pages.theme-inject';
|
||||
|
||||
public array $data = [];
|
||||
@@ -44,27 +46,36 @@ class ThemeInject extends Page
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
$tabs = [];
|
||||
$i = 0;
|
||||
$groups = [
|
||||
'页面级' => ['head', 'header', 'content_top', 'content_bottom', 'footer', 'body_end'],
|
||||
'侧边栏级' => ['sidebar_top', 'sidebar_bottom'],
|
||||
'文章级' => ['post_content_top', 'post_content_bottom'],
|
||||
];
|
||||
|
||||
foreach (ThemeInjector::POINTS as $point => $label) {
|
||||
$tabs[] = Tab::make(($i + 1).'. '.$label)
|
||||
->schema([
|
||||
Repeater::make("inject.{$point}")
|
||||
->label('注入块(可多条,拖拽排序,按顺序渲染)')
|
||||
->schema([
|
||||
TextInput::make('title')->label('名称')->placeholder('如:百度统计')->columnSpan(2),
|
||||
Textarea::make('html')->label('内容(HTML)')->rows(3)->columnSpanFull(),
|
||||
Toggle::make('enabled')->label('启用')->default(true),
|
||||
])
|
||||
->columns(3)
|
||||
->defaultItems(0)
|
||||
->collapsible()
|
||||
->reorderable()
|
||||
->reorderableWithButtons()
|
||||
->addActionLabel('添加一条'),
|
||||
]);
|
||||
$i++;
|
||||
$tabs = [];
|
||||
|
||||
foreach ($groups as $groupLabel => $points) {
|
||||
$sections = [];
|
||||
foreach ($points as $point) {
|
||||
$sections[] = \Filament\Schemas\Components\Section::make(ThemeInjector::POINTS[$point])
|
||||
->description($point)
|
||||
->schema([
|
||||
Repeater::make("inject.{$point}")
|
||||
->label('注入块(多条按拖拽顺序渲染)')
|
||||
->schema([
|
||||
TextInput::make('title')->label('名称')->placeholder('如:百度统计')->columnSpan(2),
|
||||
Textarea::make('html')->label('内容(HTML)')->rows(3)->columnSpanFull(),
|
||||
Toggle::make('enabled')->label('启用')->default(true),
|
||||
])
|
||||
->columns(3)
|
||||
->defaultItems(0)
|
||||
->collapsible()
|
||||
->reorderable()
|
||||
->reorderableWithButtons()
|
||||
->addActionLabel('添加一条'),
|
||||
]);
|
||||
}
|
||||
$tabs[] = Tab::make($groupLabel)->schema($sections);
|
||||
}
|
||||
|
||||
$tabs[] = Tab::make('主题变量(stylevar)')
|
||||
|
||||
@@ -21,6 +21,8 @@ class Themes extends Page
|
||||
|
||||
protected static ?string $navigationLabel = '主题管理';
|
||||
|
||||
protected static ?string $title = '主题管理';
|
||||
|
||||
protected string $view = 'filament.pages.themes';
|
||||
|
||||
public $zip;
|
||||
|
||||
Reference in New Issue
Block a user