- Sites (Domain, Theme, Farben; mehrfähig für weitere Vermieter), Seiten aus Bausteinen mit Menüs, Erscheinungsbilder mit jährlichem Zeitplan, Priorität und signierter Vorschau - Theme-Kern (app/Themes): Manifest, Registry, Vererbung (Child-Themes), Token-Farben als CSS-Variablen, Bausteinkatalog als Registry (config/themes.php) - 15 Bausteine: Titelbereich mit Suche, Eckdaten, Text mit Bildern, Galerie, Ausstattung, Lage, Preise, Angebote, Kalender & Anfrage, Bewertungen, Gastgeber, FAQ, Abschluss, Kontakt, Fließtext - Theme Ostsee-Licht: Layout, Kopf/Fuß, Banner, mobile Buchungsleiste, Lightbox, selbst gehostete Schriften, Reduced Motion - Seiten Start, Wohnung, Kühlungsborn, Preise & Buchung, Kontakt, Impressum, Datenschutz; Sitemap, robots.txt, JSON-LD - Admin: Seiten-Baukasten, Erscheinungsbilder, Websites - Dokumentation docs/THEMES.md inkl. Übergabe für die Design-Sitzung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.0 KiB
PHP
65 lines
2.0 KiB
PHP
<?php
|
||
|
||
namespace App\Themes\Sections;
|
||
|
||
use App\Support\Content;
|
||
use App\Themes\Theme;
|
||
use Filament\Forms\Components\RichEditor;
|
||
use Filament\Forms\Components\Select;
|
||
use Filament\Forms\Components\TextInput;
|
||
use Filament\Schemas\Components\Utilities\Get;
|
||
|
||
/**
|
||
* Plain text page content – own text or one of the central texts (imprint, privacy policy, house rules …).
|
||
*/
|
||
class RichTextSection extends Section
|
||
{
|
||
/** Central texts that can be shown by reference, so they are maintained in one place. */
|
||
public const SOURCES = [
|
||
'own' => 'Eigener Text',
|
||
'legal.imprint' => 'Impressum (Texte › Rechtliches)',
|
||
'legal.privacy' => 'Datenschutzerklärung (Texte › Rechtliches)',
|
||
'stay.house_rules' => 'Hausregeln (Texte › Aufenthalt)',
|
||
'stay.cancellation' => 'Stornobedingungen (Texte › Aufenthalt)',
|
||
];
|
||
|
||
public static function key(): string
|
||
{
|
||
return 'rich_text';
|
||
}
|
||
|
||
public static function label(): string
|
||
{
|
||
return 'Fließtext';
|
||
}
|
||
|
||
public static function icon(): string
|
||
{
|
||
return 'heroicon-o-bars-3-bottom-left';
|
||
}
|
||
|
||
public static function schema(): array
|
||
{
|
||
return [
|
||
TextInput::make('heading')->label('Überschrift')->maxLength(160),
|
||
Select::make('source')->label('Inhalt')->options(self::SOURCES)->default('own')->live(),
|
||
RichEditor::make('text')
|
||
->label('Text')
|
||
->visible(fn (Get $get): bool => ($get('source') ?? 'own') === 'own')
|
||
->toolbarButtons([['bold', 'italic', 'link'], ['h2', 'h3'], ['bulletList', 'orderedList']]),
|
||
];
|
||
}
|
||
|
||
public function data(Theme $theme, array $data): array
|
||
{
|
||
$source = $data['source'] ?? 'own';
|
||
|
||
return [
|
||
'heading' => $data['heading'] ?? null,
|
||
'text' => $source === 'own' || ! array_key_exists($source, self::SOURCES)
|
||
? $this->html($data['text'] ?? null)
|
||
: (filled(Content::get($source)) ? Content::html($source) : null),
|
||
];
|
||
}
|
||
}
|