- Hinweisleiste per B2IN_ANNOUNCEMENT_BAR ausgeblendet (Standard aus) - Hero: „Räume aus einer Hand.“ als neue Überschrift, zweiter Button entfernt - Projekttext mit zentralem deutschen Vertragspartner (Punkt statt Gedankenstrich) - Otterpohl als vierte Kernmarke: Text v2, Abschnitt „Montage“, Titelbild getauscht - Markenabschnitte: Absätze mit „- “ als Liste mit fetter Einleitung - Titelbilder und Galerien für CABINET, Rotpunkt, Febrü und Otterpohl (WebP) - Feedback 17.09. in den Markentexten, Demobilder entfernt, WhatsApp-Nummer - Palette „Modern“ fest ohne Schalter, Entwurf /entwurf mit Hero-Slideshow - Seeder-Liste fürs Deployment im Entwicklungsplan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
89 lines
2.6 KiB
PHP
89 lines
2.6 KiB
PHP
<?php
|
||
|
||
namespace App\Livewire\Web\Components\Sections;
|
||
|
||
use App\Models\CmsBrand;
|
||
use Livewire\Component;
|
||
|
||
class BrandDetail extends Component
|
||
{
|
||
public string $slug = '';
|
||
|
||
/** @var array<string, mixed> */
|
||
public array $brand = [];
|
||
|
||
/** @var array<int, array<string, mixed>> */
|
||
public array $otherBrands = [];
|
||
|
||
/**
|
||
* Galerie getrennt nach realisierten Projekten und Inspirationen.
|
||
*
|
||
* @var array{projects: array<int, array<string, mixed>>, inspirations: array<int, array<string, mixed>>}
|
||
*/
|
||
public array $gallery = ['projects' => [], 'inspirations' => []];
|
||
|
||
public function mount(string $slug): void
|
||
{
|
||
$brands = CmsBrand::forFrontend();
|
||
|
||
abort_unless(isset($brands[$slug]), 404);
|
||
|
||
$this->slug = $slug;
|
||
$this->brand = $brands[$slug];
|
||
$this->gallery = CmsBrand::groupGallery($this->brand['gallery'] ?? []);
|
||
$this->otherBrands = collect($brands)
|
||
->reject(fn (array $brand, string $key) => $key === $slug)
|
||
->values()
|
||
->all();
|
||
|
||
$craft = $this->craftSection($slug, $brands);
|
||
|
||
if ($craft !== null) {
|
||
$this->brand['sections'][] = $craft;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Gemeinsamer Handwerk-Abschluss (Lang-Sektion `brand_craft`, Nachtrag 15): steht als letzter
|
||
* Abschnitt auf jeder Markenseite – außer auf der Seite der Handwerksmarke selbst. Der Link
|
||
* dorthin erscheint nur, wenn diese Marke veröffentlicht ist und eine Detailseite hat.
|
||
*
|
||
* @param array<string, array<string, mixed>> $brands
|
||
* @return array<string, mixed>|null
|
||
*/
|
||
private function craftSection(string $slug, array $brands): ?array
|
||
{
|
||
$content = cms_theme_section('brand_craft');
|
||
|
||
if (! is_array($content)) {
|
||
return null;
|
||
}
|
||
|
||
$craftSlug = (string) ($content['brand_slug'] ?? '');
|
||
|
||
if ($craftSlug !== '' && $craftSlug === $slug) {
|
||
return null;
|
||
}
|
||
|
||
$sections = CmsBrand::normalizeSections([$content]);
|
||
|
||
if ($sections === []) {
|
||
return null;
|
||
}
|
||
|
||
$section = $sections[0];
|
||
$section['anchor'] = 'handwerk';
|
||
|
||
if ($craftSlug !== '' && ! empty($brands[$craftSlug]['has_detail_page'])) {
|
||
$section['link'] = route('marken.show', ['slug' => $craftSlug]);
|
||
$section['link_text'] = (string) ($content['link_text'] ?? $brands[$craftSlug]['name'] ?? '');
|
||
}
|
||
|
||
return $section;
|
||
}
|
||
|
||
public function render()
|
||
{
|
||
return view('livewire.web.components.sections.brand-detail');
|
||
}
|
||
}
|