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
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Photos\Schemas;
|
||||
|
||||
use App\Enums\PhotoCategory;
|
||||
use App\Models\Appearance;
|
||||
use App\Models\Photo;
|
||||
use App\Models\Property;
|
||||
use App\Support\CurrentProperty;
|
||||
@@ -47,9 +48,29 @@ public static function configure(Schema $schema): Schema
|
||||
->options(fn (): array => Property::query()->pluck('name', 'id')->all())
|
||||
->default(fn (): ?int => app(CurrentProperty::class)->id())
|
||||
->placeholder('– keine (z. B. Umgebung) –'),
|
||||
Select::make('appearance_ids')
|
||||
->label('Zeigen in')
|
||||
->multiple()
|
||||
->options(fn (): array => Appearance::photoOptions())
|
||||
->placeholder('ganzjährig')
|
||||
->helperText('Leer = ganzjährig. Mit Auswahl erscheint das Foto nur in diesen Erscheinungsbildern – dann vor den ganzjährigen Fotos.')
|
||||
->dehydrateStateUsing(fn (?array $state): ?array => self::appearanceIds($state)),
|
||||
Toggle::make('is_published')
|
||||
->label('Auf der Webseite zeigen')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selected appearances as integers, null for "all year".
|
||||
*
|
||||
* @param array<int|string>|null $state
|
||||
* @return list<int>|null
|
||||
*/
|
||||
public static function appearanceIds(?array $state): ?array
|
||||
{
|
||||
$ids = array_values(array_unique(array_map('intval', array_filter((array) $state))));
|
||||
|
||||
return $ids === [] ? null : $ids;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user