Saisonfotos am Foto statt am Erscheinungsbild
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>
This commit is contained in:
1 parent
d02f3e05c7
commit
791786ed3e
21 files changed
+449
-235
No files matched your search
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Themes\Sections;
|
||||
|
||||
use App\Models\Photo;
|
||||
use App\Themes\Theme;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -32,23 +31,19 @@ public static function schema(): array
|
||||
return [
|
||||
TextInput::make('title')->label('Überschrift')->required()->maxLength(160),
|
||||
Textarea::make('text')->label('Text')->rows(2),
|
||||
static::photoSelect('photo_id', 'Hintergrundfoto'),
|
||||
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 static function photoSlots(): array
|
||||
{
|
||||
return ['photo_id' => ['label' => 'Hintergrundfoto', 'type' => self::SLOT_SINGLE]];
|
||||
}
|
||||
|
||||
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->seasonalPhoto($theme, $data, 'photo_id') ?? (isset($data['photo_id']) ? Photo::find($data['photo_id']) : 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'),
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user