Theme-System mit Basis-Theme Ostsee-Licht, Bausteinen und saisonalen Erscheinungsbildern
- Sites (Domain, Theme, Farben; mehrfähig für weitere Vermieter), Seiten aus Bausteinen mit Menüs, Erscheinungsbilder mit jährlichem Zeitplan, Priorität und signierter Vorschau - Theme-Kern (app/Themes): Manifest, Registry, Vererbung (Child-Themes), Token-Farben als CSS-Variablen, Bausteinkatalog als Registry (config/themes.php) - 15 Bausteine: Titelbereich mit Suche, Eckdaten, Text mit Bildern, Galerie, Ausstattung, Lage, Preise, Angebote, Kalender & Anfrage, Bewertungen, Gastgeber, FAQ, Abschluss, Kontakt, Fließtext - Theme Ostsee-Licht: Layout, Kopf/Fuß, Banner, mobile Buchungsleiste, Lightbox, selbst gehostete Schriften, Reduced Motion - Seiten Start, Wohnung, Kühlungsborn, Preise & Buchung, Kontakt, Impressum, Datenschutz; Sitemap, robots.txt, JSON-LD - Admin: Seiten-Baukasten, Erscheinungsbilder, Websites - Dokumentation docs/THEMES.md inkl. Übergabe für die Design-Sitzung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2c48013ad
commit
66e82d61f5
119 files changed
+4066
-481
No files matched your search
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Themes;
|
||||
|
||||
/**
|
||||
* Discovers the themes below config('themes.paths').
|
||||
*/
|
||||
class ThemeRegistry
|
||||
{
|
||||
/** @var array<string, ThemeManifest>|null */
|
||||
private ?array $themes = null;
|
||||
|
||||
/**
|
||||
* @return array<string, ThemeManifest>
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
if ($this->themes === null) {
|
||||
$this->themes = [];
|
||||
foreach (config('themes.paths') as $path) {
|
||||
foreach (glob(rtrim($path, '/\\').'/*/theme.json') ?: [] as $file) {
|
||||
$manifest = ThemeManifest::fromFile($file);
|
||||
$this->themes[$manifest->key] = $manifest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->themes;
|
||||
}
|
||||
|
||||
public function get(string $key): ThemeManifest
|
||||
{
|
||||
return $this->all()[$key] ?? $this->all()[config('themes.base')];
|
||||
}
|
||||
|
||||
/**
|
||||
* The theme followed by its ancestors, ending with the base theme.
|
||||
*
|
||||
* @return list<ThemeManifest>
|
||||
*/
|
||||
public function chain(string $key): array
|
||||
{
|
||||
$chain = [];
|
||||
$current = $this->get($key);
|
||||
|
||||
while (! isset($chain[$current->key])) {
|
||||
$chain[$current->key] = $current;
|
||||
if ($current->parent === null || ! isset($this->all()[$current->parent])) {
|
||||
break;
|
||||
}
|
||||
$current = $this->all()[$current->parent];
|
||||
}
|
||||
|
||||
$base = $this->get(config('themes.base'));
|
||||
$chain[$base->key] ??= $base;
|
||||
|
||||
return array_values($chain);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function options(): array
|
||||
{
|
||||
return array_map(fn (ThemeManifest $theme): string => "{$theme->name} ({$theme->version})", $this->all());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user