Startseite frei gestalten, Neuigkeiten-Block mit Kategorien-Filter (0.26.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m21s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m55s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m34s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m21s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m55s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m34s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6290e09074
commit
2c96fcce1c
151 changed files with 1515 additions and 317 deletions
|
|
@ -84,6 +84,56 @@ class Widgets
|
|||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Kacheln zur Auswahl (Startseiten-Baukasten): Schlüssel => Name.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function options(): array
|
||||
{
|
||||
return $this->candidates()->map(fn (array $w) => $w['label'])->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sichtbare Kacheln je Bereich in gespeicherter Reihenfolge (Ausgangspunkt für den Baukasten).
|
||||
*
|
||||
* @return array<string, list<string>> Bereich => Schlüssel
|
||||
*/
|
||||
public function arrangement(): array
|
||||
{
|
||||
$layout = $this->layout();
|
||||
|
||||
return $this->candidates()
|
||||
->filter(fn (array $w, string $key) => $layout[$key]['visible'] ?? true)
|
||||
->groupBy(fn (array $w) => $w['area'], preserveKeys: true)
|
||||
->map(fn ($widgets) => $widgets->keys()->all())
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Eine Kachel für eine Person berechnen (Baustein „Kachel“ der frei gestalteten Startseite).
|
||||
*
|
||||
* @return array{component: string, props: array<string, mixed>}|null
|
||||
*/
|
||||
public function resolveOne(string $key, User $user, Request $request): ?array
|
||||
{
|
||||
$widget = $this->candidates($user)->get($key);
|
||||
|
||||
if (! $widget || ! app(PluginAccess::class)->allows($key, $user)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$props = ($widget['props'])($user, $request);
|
||||
} catch (Throwable $e) {
|
||||
Log::error("Startseiten-Kachel {$key} fehlgeschlagen: ".$e->getMessage(), ['exception' => $e]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $props === null ? null : ['component' => $widget['component'], 'props' => $props];
|
||||
}
|
||||
|
||||
/**
|
||||
* Mitgelieferte Kacheln plus eigene Kacheln, sortiert nach gespeicherter Anordnung.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue