b2in/app/Livewire/Web/Components/Ui/Footer.php
Kevin Adametz a661a68913 Hotfix: Livewire-UI-Komponenten im Ordner Ui (wie der Namespace)
Der Ordner hieß im Repository UI, der Namespace App\Livewire\Web\Components\Ui. Auf dem
Mac fällt das nicht auf, auf Linux findet der Autoloader die Klassen nicht: Header,
Footer usw. rendern ohne Klasse (500, Undefined variable $logoPath). Wächtertest prüft
Pfad und Namespace auf gleiche Schreibweise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 09:11:39 +00:00

69 lines
2.4 KiB
PHP

<?php
namespace App\Livewire\Web\Components\Ui;
use Livewire\Component;
class Footer extends Component
{
/** @var array<string, mixed> */
public array $content = [];
/** Farbwelt der Seite (`interior` | `immobilien`), in mount() festgehalten. */
public string $world = 'interior';
/** @var array<string, array{label: string, url: string, active: bool}> */
public array $worlds = [];
public string $logoPath = '';
/**
* Negatives Logo für die Farbvariante „Modern“ (Nachtrag 18): dort liegt der Interior-Footer
* dunkel in Tanne. Die Palette schaltet im Browser, deshalb liegen beide Logos im Markup und
* das Stylesheet blendet das passende ein. Leer in der Immobilien-Welt, die ohnehin das
* negative Logo trägt.
*/
public string $logoPathDark = '';
/**
* Fuer die Immobilien-Welt zeigen die gemeinsamen Footer-Links auf die Seiten dieser Welt.
*
* @var array<string, string>
*/
private const IMMOBILIEN_LINKS = [
'/faq' => '/immobilien/faq',
'/about' => '/immobilien/ueber-b2in',
'/magazin' => '/immobilien/magazin',
];
public function mount(): void
{
$section = cms_theme_section('footer');
$this->content = is_array($section) ? $section : [];
$this->world = b2in_world();
if ($this->world === 'immobilien' && is_array($this->content['links'] ?? null)) {
$this->content['links'] = array_map(function ($link) {
if (is_array($link) && isset(self::IMMOBILIEN_LINKS[$link['url'] ?? ''])) {
$link['url'] = self::IMMOBILIEN_LINKS[$link['url']];
}
return $link;
}, $this->content['links']);
}
$this->worlds = b2in_worlds($this->world);
// Der Interior-Footer liegt auf Sand (helle Fläche) und trägt deshalb das positive
// Logo; der Immobilien-Footer bleibt dunkel und nutzt die negative Variante.
$variant = $this->world === 'immobilien' ? 'negative' : 'positive';
$this->logoPath = \App\Helpers\ThemeHelper::getLogoPath($variant, $this->world);
$this->logoPathDark = $this->world === 'immobilien'
? ''
: \App\Helpers\ThemeHelper::getLogoPath('negative', $this->world);
}
public function render()
{
return view('livewire.web.components.ui.footer');
}
}