Menü: Symbole je Menüpunkt, gemeinsame Symbolauswahl
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m33s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m41s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m41s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m18s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m9s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m0s

- Optionales Symbol für jeden Menü- und Unterpunkt (Kopfzeile,
  Aufklappmenüs, „Mehr“, Handy-Menü)
- Gemeinsame Liste resources/icons/icons.json (66 Lucide-Symbole) für
  Menü, Schnellzugriffe und Pagebuilder; `npm run icons` erzeugt
  Frontend-Zuordnung und SVGs für die Vorschau im Admin
- Admin-Auswahl mit Symbolvorschau und Suche

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 14:14:52 +00:00
parent dda250aaad
commit 23c36d28b5
179 changed files with 872 additions and 684 deletions

View file

@ -4,6 +4,7 @@ namespace App\Filament\Pages;
use App\Models\Role;
use App\Support\Audit;
use App\Support\Icons;
use App\Support\Navigation;
use App\Support\Settings;
use BackedEnum;
@ -19,6 +20,7 @@ use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use UnitEnum;
@ -114,6 +116,9 @@ class MenuSettings extends Page
TextInput::make('label')->label('Bezeichnung')->maxLength(60)
->placeholder(fn (Get $get) => in_array($get('type'), ['link', 'group'], true) ? '' : 'wie Bereich bzw. Seite')
->required(fn (Get $get) => in_array($get('type'), ['link', 'group'], true)),
Select::make('icon')->label('Symbol')->placeholder('Ohne')->native(false)
->options(Icons::options())->allowHtml()->searchable()
->getSearchResultsUsing(fn (string $search) => Icons::search($search)),
Toggle::make('subpages')->label('Unterseiten als Untermenü')->inline(false)
->visible(fn (Get $get) => $get('type') === 'page'),
Toggle::make('new_tab')->label('In neuem Tab öffnen')->inline(false)
@ -142,7 +147,7 @@ class MenuSettings extends Page
/**
* @param array<string, mixed> $state
*/
private function itemLabel(array $state): string
private function itemLabel(array $state): HtmlString
{
$navigation = app(Navigation::class);
$type = (string) ($state['type'] ?? '');
@ -160,7 +165,10 @@ class MenuSettings extends Page
$kind = ['module' => 'Bereich', 'link' => 'Link', 'group' => 'Gruppe'][$type] ?? ($navigation->sourceTypes()[$type] ?? '');
$children = count((array) ($state['children'] ?? []));
return $label.' · '.$kind.($children ? " · {$children} Unterpunkte" : '').(! empty($state['roles']) ? ' · eingeschränkt' : '');
$text = e($label).' · '.e($kind).($children ? " · {$children} Unterpunkte" : '').(! empty($state['roles']) ? ' · eingeschränkt' : '');
return new HtmlString('<span style="display:inline-flex;align-items:center;gap:8px">'
.(Icons::has($state['icon'] ?? null) ? Icons::svg($state['icon'], 16) : '').$text.'</span>');
}
/**
@ -194,6 +202,7 @@ class MenuSettings extends Page
'target' => isset($item['target']) ? (string) $item['target'] : null,
'url' => $item['url'] ?? null,
'label' => filled($item['label'] ?? null) ? trim($item['label']) : null,
'icon' => Icons::has($item['icon'] ?? null) ? $item['icon'] : null,
'subpages' => ! empty($item['subpages']),
'new_tab' => ! empty($item['new_tab']),
'roles' => array_values(array_map('intval', (array) ($item['roles'] ?? []))),