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:
LarsandClaude Opus 5.5 committed 2026-10-29 18:53:56 +01:00
1 parent d02f3e05c7
commit 791786ed3e
21 files changed
+449 -235

No files matched your search

+5 -8
View File
@@ -3,11 +3,12 @@
namespace App\Themes\Sections;
use App\Enums\PhotoCategory;
use App\Models\Photo;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Group;
use Filament\Schemas\Components\Utilities\Get;
/**
* Location: text, photos of the area and a map link (no embedded third-party map, so no consent needed).
@@ -35,15 +36,11 @@ public static function schema(): array
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->required()->maxLength(160),
RichEditor::make('text')->label('Text')->toolbarButtons([['bold', 'italic', 'link'], ['bulletList']]),
Toggle::make('show_photos')->label('Bilder der Umgebung zeigen')->default(true),
Toggle::make('show_photos')->label('Bilder zeigen')->default(true)->live(),
Group::make(static::photoSourceFields('Automatisch: Fotos der Umgebung'))->visible(fn (Get $get): bool => (bool) $get('show_photos')),
];
}
public static function photoSlots(): array
{
return ['photo_ids' => ['label' => 'Bilder der Umgebung', 'type' => self::SLOT_COLLECTION]];
}
public function data(Theme $theme, array $data): array
{
$address = $theme->property()?->address;
@@ -55,7 +52,7 @@ public function data(Theme $theme, array $data): array
'address' => $address,
'mapUrl' => $address ? 'https://www.openstreetmap.org/search?query='.rawurlencode($address) : null,
'photos' => ($data['show_photos'] ?? true)
? $this->withSeasonalPhotos($theme, $data, 'photo_ids', Photo::query()->published()->with('media')->where('category', PhotoCategory::Area)->limit(6)->get())
? $this->sourcedPhotos($theme, $data, PhotoCategory::Area, 6)
: collect(),
];
}