Files
LarsandClaude Opus 5.5 791786ed3e 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>
2026-10-29 18:53:56 +01:00

51 lines
1.6 KiB
PHP

<?php
namespace App\Themes\Sections;
use App\Enums\PhotoCategory;
use App\Themes\Theme;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get;
/**
* Photo gallery of one category (or all), opened in a lightbox.
*/
class GallerySection extends Section
{
public static function key(): string
{
return 'gallery';
}
public static function label(): string
{
return 'Bildergalerie';
}
public static function icon(): string
{
return 'heroicon-o-rectangle-group';
}
public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->maxLength(120),
...static::photoSourceFields('Automatisch nach Kategorie'),
Select::make('category')->label('Kategorie')->visible(fn (Get $get): bool => $get('photo_source') !== 'selection')->options(['all' => 'Alle', ...collect(PhotoCategory::forGalleries())->mapWithKeys(fn (PhotoCategory $category): array => [$category->value => $category->getLabel()])->all()])->default('all'),
TextInput::make('limit')->label('Anzahl (leer = alle)')->integer()->minValue(1),
];
}
public function data(Theme $theme, array $data): array
{
$category = PhotoCategory::tryFrom($data['category'] ?? '');
return [
'heading' => $data['heading'] ?? null,
'photos' => $this->sourcedPhotos($theme, $data, $category, filled($data['limit'] ?? null) ? (int) $data['limit'] : null),
];
}
}