Files
Lars StommerandClaude Opus 5.5 7d0bc93abc Offers by their own rules, seasonal photos per section, theme authoring tooling
- Special offers: kinds (rule, fixed dates, gap filler), package price, priority, highlight;
  GapFinder detects calendar gaps (optionally waiving the minimum stay); OfferShowcase decides
  what the website advertises and prices fixed dates/gaps with PriceCalculator; offers section
  shows them side by side, as a list or rotating; hero can show the top offer. Appearances no
  longer carry a featured offer.
- Sections get stable ids; appearances set photos per section ("Bilder je Baustein") and
  sections can be limited to appearances. Photo pickers show thumbnails everywhere.
- Themes: themes:make (scaffold, never overwrites), themes:check (contract, build, markup,
  colours, external resources, WCAG contrast), themes:preview (signed links per page and
  appearance), signed ?theme= preview and preview action in the site form, inherited colour
  tokens in the admin. Base CSS split into theme.css + reusable theme-base.css.
- docs/THEME-ERSTELLUNG.md: binding guide for building additional themes elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:51:38 +02:00

63 lines
1.9 KiB
PHP

<?php
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;
/**
* Location: text, photos of the area and a map link (no embedded third-party map, so no consent needed).
*/
class LocationSection extends Section
{
public static function key(): string
{
return 'location';
}
public static function label(): string
{
return 'Lage & Umgebung';
}
public static function icon(): string
{
return 'heroicon-o-map-pin';
}
public static function schema(): array
{
return [
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),
];
}
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;
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? '',
'text' => $this->html($data['text'] ?? null),
'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())
: collect(),
];
}
}