Files
fewo-stommer/app/Themes/Sections/TextImageSection.php
T
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

61 lines
2.0 KiB
PHP

<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
/**
* Heading and text next to up to three photos, optionally with a link to another page.
*/
class TextImageSection extends Section
{
public static function key(): string
{
return 'text_image';
}
public static function label(): string
{
return 'Text mit Bildern';
}
public static function icon(): string
{
return 'heroicon-o-document-text';
}
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', 'orderedList']]),
static::photoSelect('photo_ids', 'Bilder (bis zu 3)', multiple: true)->maxItems(3),
Select::make('image_position')->label('Bilder')->options(['right' => 'rechts', 'left' => 'links'])->default('right'),
TextInput::make('link_label')->label('Link-Text')->maxLength(80),
static::pageSelect('link_page', 'Link zur Seite'),
];
}
public static function photoSlots(): array
{
return ['photo_ids' => ['label' => 'Bilder', 'type' => self::SLOT_MULTIPLE, 'max' => 3]];
}
public function data(Theme $theme, array $data): array
{
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? '',
'text' => $this->html($data['text'] ?? null),
'photos' => $this->seasonalPhotos($theme, $data, 'photo_ids') ?? $this->photos($data['photo_ids'] ?? []),
'imagePosition' => $data['image_position'] ?? 'right',
'linkLabel' => $data['link_label'] ?? null,
'linkUrl' => $this->pageUrl($data['link_page'] ?? null),
];
}
}