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\Pricing\OfferShowcase;
|
||||
use App\Themes\Theme;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
@@ -35,7 +34,8 @@ public static function schema(): array
|
||||
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
|
||||
TextInput::make('title')->label('Überschrift')->helperText('*Wort* wird hervorgehoben (kursiv).')->required()->maxLength(160),
|
||||
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
|
||||
static::photoSelect('photo_id', 'Foto (wenn das Erscheinungsbild keins vorgibt)'),
|
||||
static::photoSelect('photo_ids', 'Fotos', multiple: true)
|
||||
->helperText('Gezeigt wird das erste Foto, das zum Erscheinungsbild passt; leer = automatisch ein Foto der Wohnung. '.self::SEASON_HINT),
|
||||
Toggle::make('show_search')->label('Verfügbarkeitssuche anzeigen')->default(true),
|
||||
Toggle::make('show_offer')
|
||||
->label('Hervorgehobenes Sonderangebot im Titelbereich zeigen')
|
||||
@@ -44,16 +44,8 @@ public static function schema(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function photoSlots(): array
|
||||
{
|
||||
return ['photo_id' => ['label' => 'Foto', 'type' => self::SLOT_SINGLE]];
|
||||
}
|
||||
|
||||
public function data(Theme $theme, array $data): array
|
||||
{
|
||||
$fallback = isset($data['photo_id'])
|
||||
? Photo::find($data['photo_id'])
|
||||
: Photo::query()->published()->forGalleries()->when($theme->property(), fn ($query, $property) => $query->whereBelongsTo($property))->first() ?? Photo::query()->published()->forGalleries()->first();
|
||||
$featuredOffer = ($data['show_offer'] ?? true) && $theme->property()
|
||||
? app(OfferShowcase::class)->current($theme->property(), limit: 1, featuredOnly: true)->first()
|
||||
: null;
|
||||
@@ -62,7 +54,7 @@ public function data(Theme $theme, array $data): array
|
||||
'eyebrow' => $theme->text('hero.eyebrow', $data['eyebrow'] ?? null),
|
||||
'title' => $theme->text('hero.title', $data['title'] ?? $theme->site->name),
|
||||
'text' => $theme->text('hero.text', $data['text'] ?? null),
|
||||
'photo' => $this->seasonalPhoto($theme, $data, 'photo_id') ?? $theme->heroPhoto($fallback),
|
||||
'photo' => $this->chosenPhotos($theme, $data['photo_ids'] ?? [])->first() ?? $this->automaticPhotos($theme, limit: 1)->first(),
|
||||
'featuredOffer' => $featuredOffer,
|
||||
'showSearch' => (bool) ($data['show_search'] ?? true),
|
||||
'property' => $theme->property(),
|
||||
|
||||
Reference in new issue
Block a user