Globale Fußzeile mit Baukasten (0.38.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 10m3s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m26s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m59s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 11m24s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m26s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 49s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 10m3s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m26s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m59s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 11m24s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m26s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 49s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6f59caa880
commit
8eb5d4a475
189 changed files with 1011 additions and 571 deletions
72
app/Layout/Footer.php
Normal file
72
app/Layout/Footer.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Layout;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Pagebuilder\Content;
|
||||
use App\Pagebuilder\StoredDocument;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Globale Fußzeile auf allen Portalseiten – mit dem Seitenbaukasten frei gestaltet
|
||||
* (Spalten, Text, Links, Kacheln …). Text und Links aus „Erscheinungsbild → Fußzeile“
|
||||
* stehen weiterhin als schmale Zeile ganz unten.
|
||||
*/
|
||||
class Footer
|
||||
{
|
||||
use StoredDocument;
|
||||
|
||||
public const MAX_REVISIONS = 20;
|
||||
|
||||
public function __construct(private readonly Settings $settings, private readonly Content $content) {}
|
||||
|
||||
protected function prefix(): string
|
||||
{
|
||||
return 'footer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Vorschlag für den Anfang: drei Spalten mit Überschrift und Text bzw. Links.
|
||||
*
|
||||
* @return array{blocks: list<array<string, mixed>>}
|
||||
*/
|
||||
protected function initial(): array
|
||||
{
|
||||
$column = fn (string $heading, array $block) => ['id' => Str::random(12), 'blocks' => [
|
||||
['id' => Str::random(12), 'type' => 'heading', 'data' => ['text' => $heading, 'level' => '4']],
|
||||
['id' => Str::random(12), ...$block],
|
||||
]];
|
||||
|
||||
return $this->content->sanitize(['blocks' => [
|
||||
['id' => Str::random(12), 'type' => 'columns', 'data' => ['layout' => '1-1-1', 'stack' => 'md', 'gap' => 'normal', 'align' => 'start'], 'items' => [
|
||||
$column('Über uns', ['type' => 'text', 'data' => ['html' => '<p>Kurzer Text über Ihr Haus – Anschrift, Telefon, Leitbild.</p>']]),
|
||||
$column('Schnell gefunden', ['type' => 'icon-list', 'data' => ['items' => [
|
||||
['icon' => 'phone', 'title' => 'Telefonbuch', 'text' => '', 'url' => '/personen'],
|
||||
['icon' => 'calendar-days', 'title' => 'Termine', 'text' => '', 'url' => '/termine'],
|
||||
['icon' => 'file-text', 'title' => 'Impressum', 'text' => '', 'url' => '/seiten/impressum'],
|
||||
]]]),
|
||||
$column('Kontakt', ['type' => 'text', 'data' => ['html' => '<p>Zentrale: 0000 000000<br>info@example.org</p>']]),
|
||||
]],
|
||||
]]);
|
||||
}
|
||||
|
||||
/** Gestaltete Fußzeile ausblenden – Versionen bleiben erhalten */
|
||||
public function unpublish(): void
|
||||
{
|
||||
$this->settings->setMany(['footer.content' => null, 'footer.published_at' => now()->toIso8601String()]);
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return ($this->published()['blocks'] ?? []) !== [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{blocks: list<array<string, mixed>>}
|
||||
*/
|
||||
public function render(User $user, bool $draft = false): array
|
||||
{
|
||||
return $this->content->render($draft ? $this->working() : ($this->published() ?? ['blocks' => []]), $user, ['footer' => true]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue