Loheide-eu-mitarbeiterplatt.../app/Filament/Pages/FooterSettings.php
Friederich Loheide 8eb5d4a475
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
Globale Fußzeile mit Baukasten (0.38.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 15:59:26 +00:00

78 lines
3.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Filament\Pages;
use App\Filament\Clusters\HomepageCluster;
use App\Filament\Pages\Appearance\AppearanceFooter;
use App\Layout\Footer;
use App\Support\Audit;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Text;
use Filament\Schemas\Schema;
use Filament\Support\Enums\FontWeight;
use Filament\Support\Icons\Heroicon;
/**
* Globale Fußzeile: Status und Einstieg in den Baukasten.
*/
class FooterSettings extends Page
{
protected string $view = 'filament.pages.schema-only';
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBars3BottomLeft;
protected static ?string $cluster = HomepageCluster::class;
protected static ?int $navigationSort = 3;
protected static ?string $navigationLabel = 'Fußzeile';
protected static ?string $title = 'Fußzeile';
protected static ?string $slug = 'fusszeile';
public static function canAccess(): bool
{
return auth()->user()?->can('appearance.manage') ?? false;
}
public function form(Schema $schema): Schema
{
$footer = app(Footer::class);
$blocks = count($footer->published()['blocks'] ?? []);
return $schema->components([
Section::make('Gestaltete Fußzeile')->schema([
Text::make('Unter jeder Seite des Portals – frei gestaltet mit dem Baukasten: Spalten, Text, Links (Symbolliste), Bilder und alle Kacheln der Startseite. Jeder Block lässt sich auf Rollen, Abteilungen oder Standorte beschränken.'),
Text::make(match (true) {
$footer->isActive() => 'Stand: veröffentlicht ('.$blocks.' '.($blocks === 1 ? 'Block' : 'Blöcke').').'.($footer->draft() ? ' Es gibt einen unveröffentlichten Entwurf.' : ''),
$footer->draft() !== null => 'Stand: Entwurf, noch nicht veröffentlicht.',
default => 'Stand: noch nicht gestaltet – es erscheint nur die schmale Zeile mit Text und Links.',
})->weight(FontWeight::Bold),
]),
Section::make('Schmale Zeile ganz unten')->schema([
Text::make('Copyright-Text und Links wie „Impressum“ oder „Datenschutz“ pflegen Sie weiterhin unter „Erscheinungsbild → Fußzeile & E-Mails“. Sie stehen unter der gestalteten Fußzeile.'),
]),
]);
}
protected function getHeaderActions(): array
{
return [
Action::make('design')->label('Fußzeile gestalten')->icon(Heroicon::OutlinedPaintBrush)->url('/fusszeile/gestalten'),
Action::make('strip')->label('Text & Links')->icon(Heroicon::OutlinedLink)->color('gray')->url(fn () => AppearanceFooter::getUrl()),
Action::make('hide')->label('Ausblenden')->icon(Heroicon::OutlinedEyeSlash)->color('danger')
->visible(fn () => app(Footer::class)->isActive())
->requiresConfirmation()->modalDescription('Die gestaltete Fußzeile verschwindet aus dem Portal. Im Editor lässt sie sich unter „Frühere Fassungen“ wiederherstellen.')
->action(function () {
app(Footer::class)->unpublish();
Audit::log('footer.hidden');
Notification::make()->success()->title('Fußzeile ausgeblendet')->send();
}),
];
}
}