Files
fewo-stommer/app/Console/Commands/CheckTheme.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

53 lines
1.8 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Themes\ThemeChecker;
use App\Themes\ThemeRegistry;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
#[Signature('themes:check {theme? : Key des Themes (leer = alle)}')]
#[Description('Check themes against the theme contract (docs/THEME-ERSTELLUNG.md): manifest, build, required markup, colours, contrast')]
class CheckTheme extends Command
{
/**
* Execute the console command.
*/
public function handle(ThemeRegistry $registry, ThemeChecker $checker): int
{
$key = $this->argument('theme');
if ($key !== null && ! isset($registry->all()[$key])) {
$this->error("Theme „{$key}“ nicht gefunden. Installiert: ".implode(', ', array_keys($registry->all())));
return self::FAILURE;
}
$themes = $key !== null ? [$registry->all()[$key]] : array_values($registry->all());
$failed = false;
foreach ($themes as $theme) {
['errors' => $errors, 'warnings' => $warnings] = $checker->check($theme);
$this->line('');
$this->line("<options=bold>{$theme->name}</> ({$theme->key} {$theme->version}".($theme->parent ? ", Eltern-Theme {$theme->parent}" : '').')');
foreach ($errors as $error) {
$this->line(" <fg=red>✗</> {$error}");
}
foreach ($warnings as $warning) {
$this->line(" <fg=yellow>!</> {$warning}");
}
if ($errors === [] && $warnings === []) {
$this->line(' <fg=green>✓</> Alles in Ordnung.');
}
$failed = $failed || $errors !== [];
}
$this->line('');
return $failed ? self::FAILURE : self::SUCCESS;
}
}