Ein Foto gehoert zu keinem (ganzjaehrig) oder mehreren Erscheinungsbildern und erscheint nur dort, vor den ganzjaehrigen Fotos. Bausteine waehlen "automatisch" oder eine eigene Auswahl; Titelbereich und Abschluss zeigen das erste passende Foto ihrer Liste. Titelbild und "Bilder je Baustein" des Erscheinungsbilds werden in die Bausteine uebernommen und entfallen dort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Themes\Sections;
|
|
|
|
use App\Themes\Theme;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
/**
|
|
* Closing invitation with photo and button; seasonal appearances may replace the texts.
|
|
*/
|
|
class CallToActionSection extends Section
|
|
{
|
|
public static function key(): string
|
|
{
|
|
return 'cta';
|
|
}
|
|
|
|
public static function label(): string
|
|
{
|
|
return 'Abschluss mit Aufruf';
|
|
}
|
|
|
|
public static function icon(): string
|
|
{
|
|
return 'heroicon-o-cursor-arrow-rays';
|
|
}
|
|
|
|
public static function schema(): array
|
|
{
|
|
return [
|
|
TextInput::make('title')->label('Überschrift')->required()->maxLength(160),
|
|
Textarea::make('text')->label('Text')->rows(2),
|
|
static::photoSelect('photo_ids', 'Hintergrundfotos', multiple: true)
|
|
->helperText('Gezeigt wird das erste, das zum Erscheinungsbild passt. '.self::SEASON_HINT),
|
|
TextInput::make('button_label')->label('Button-Text')->default('Belegung & Preise')->maxLength(60),
|
|
static::pageSelect('button_page', 'Button führt zu'),
|
|
];
|
|
}
|
|
|
|
public function data(Theme $theme, array $data): array
|
|
{
|
|
return [
|
|
'title' => $theme->text('cta.title', $data['title'] ?? null),
|
|
'text' => $theme->text('cta.text', $data['text'] ?? null),
|
|
'photo' => $this->chosenPhotos($theme, $data['photo_ids'] ?? [])->first(),
|
|
'buttonLabel' => $data['button_label'] ?? 'Belegung & Preise',
|
|
'buttonUrl' => $this->pageUrl($data['button_page'] ?? null) ?? route('booking.create'),
|
|
];
|
|
}
|
|
}
|