Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m40s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m35s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m38s
CI / Build-Artefakte aktuell (pull_request) Successful in 55s
- Seiten-Plugin: Seitenbaum mit Adressen, Seitennavigation, Brotkrumen und optional Hauptnavigation; Sichtbarkeit vererbt sich auf Unterseiten - Pagebuilder (Block-Registry im Kern, Plugins tragen Blöcke bei): Abschnitt, Spalten, Tabs, Akkordeon, Box, Überschrift, Text (TipTap), Zitat, Schaltflächen, Symbolliste, Tabelle, Trennlinie, Abstand, Bild, Galerie, Video (erst nach Klick), Titelbild, Ansprechpartner, Downloads, Unterseiten, Neuigkeiten, Termine; Sichtbarkeit je Block; Bereinigung beim Speichern - Editor im Portal: Ziehen und Ablegen, Autospeichern als Entwurf, Rückgängig, Gerätevorschau, Versionen, Zeitsteuerung, Bearbeitungssperre, Freigabe anfordern - Rechte „inkl. Unterseiten“ werden im Rechte-Cache aufgelöst - Neuigkeiten: Schreiben im Portal, Freigabe-Workflow mit Benachrichtigungen - Bereich „Redaktion“, Benachrichtigungen im Portal - storage/.migrations-fingerprint nicht mehr ausliefern Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
66 lines
1.9 KiB
PHP
66 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Editorial;
|
|
|
|
use App\Models\User;
|
|
use Closure;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Throwable;
|
|
|
|
/**
|
|
* Bereich „Redaktion“ im Portal: Plugins melden hier ihre Arbeitslisten an
|
|
* (z. B. „Meine Seiten“, „Zur Freigabe“). Der Menüpunkt erscheint nur, wenn
|
|
* mindestens ein Abschnitt für die Person in Frage kommt.
|
|
*/
|
|
class Editorial
|
|
{
|
|
/** @var array<string, array{label: string, component: string, sort: int, visible: Closure, props: Closure}> */
|
|
private array $sections = [];
|
|
|
|
/**
|
|
* @param Closure(User): bool $visible schnelle Rechteprüfung (ohne Abfragen)
|
|
* @param Closure(User): array<string, mixed> $props
|
|
*/
|
|
public function add(string $key, string $label, string $component, int $sort, Closure $visible, Closure $props): void
|
|
{
|
|
$this->sections[$key] = compact('label', 'component', 'sort', 'visible', 'props');
|
|
}
|
|
|
|
public function remove(string $key): void
|
|
{
|
|
unset($this->sections[$key]);
|
|
}
|
|
|
|
public function visibleFor(User $user): bool
|
|
{
|
|
foreach ($this->sections as $section) {
|
|
if (($section['visible'])($user)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* @return list<array{key: string, label: string, component: string, props: array<string, mixed>}>
|
|
*/
|
|
public function resolve(User $user): array
|
|
{
|
|
$result = [];
|
|
|
|
foreach (collect($this->sections)->sortBy('sort') as $key => $section) {
|
|
if (! ($section['visible'])($user)) {
|
|
continue;
|
|
}
|
|
|
|
try {
|
|
$result[] = ['key' => $key, 'label' => $section['label'], 'component' => $section['component'], 'props' => ($section['props'])($user)];
|
|
} catch (Throwable $e) {
|
|
Log::error("Redaktionsbereich {$key} fehlgeschlagen: ".$e->getMessage(), ['exception' => $e]);
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|