tinted-Band generalisiert (.section--tinted) und Ansprechpartner-Sektion hervorgehoben
Enthält auch User-Erweiterung: person-grid mit Abteilungs-Filter/Title/Intro-Props Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,20 +3,40 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Ansprechpartner-Grid aus data/ansprechpartner.json.
|
||||
* Optionaler Prop: $anchor (Sektions-ID, Default 'ansprechpartner').
|
||||
* Ansprechpartner-Grid aus data/ansprechpartner.json (Single Source of Truth).
|
||||
* Alle Props optional:
|
||||
* $departments array — nur diese Abteilungen zeigen (z. B. ['Herrenfußball','Damenfußball']).
|
||||
* $title string — Überschrift überschreiben (Default aus JSON).
|
||||
* $intro string — Intro-Text überschreiben (Default aus JSON; '' = ausblenden).
|
||||
* $anchor string — Sektions-ID (Default 'ansprechpartner').
|
||||
* $tinted bool — aufgehelltes Vollbreite-Band (Default true).
|
||||
*/
|
||||
$data = json_load('ansprechpartner');
|
||||
$anchor = $anchor ?? 'ansprechpartner';
|
||||
$tinted = $tinted ?? true;
|
||||
$title = $title ?? $data['title'];
|
||||
$intro = $intro ?? ($data['intro'] ?? '');
|
||||
|
||||
$persons = $data['persons'] ?? [];
|
||||
if (!empty($departments)) {
|
||||
$persons = array_values(array_filter(
|
||||
$persons,
|
||||
static fn (array $p): bool => in_array($p['department'] ?? '', $departments, true)
|
||||
));
|
||||
}
|
||||
|
||||
if ($persons === []) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<section class="section persons" id="<?= e($anchor) ?>">
|
||||
<section class="section persons<?= $tinted ? ' section--tinted' : '' ?>" id="<?= e($anchor) ?>">
|
||||
<div class="container">
|
||||
<h2><?= e($data['title']) ?></h2>
|
||||
<?php if (!empty($data['intro'])): ?>
|
||||
<p class="persons__intro"><?= e($data['intro']) ?></p>
|
||||
<h2><?= e($title) ?></h2>
|
||||
<?php if ($intro !== ''): ?>
|
||||
<p class="persons__intro"><?= e($intro) ?></p>
|
||||
<?php endif; ?>
|
||||
<ul class="persons__grid">
|
||||
<?php foreach ($data['persons'] as $person): ?>
|
||||
<?php foreach ($persons as $person): ?>
|
||||
<li>
|
||||
<?php component('person-card', ['person' => $person]); ?>
|
||||
</li>
|
||||
|
||||
@@ -12,7 +12,7 @@ $level = $level ?? 2;
|
||||
$flip = !empty($section['flip']);
|
||||
$tinted = !empty($section['tinted']);
|
||||
?>
|
||||
<section class="section split<?= $flip ? ' split--flip' : '' ?><?= $tinted ? ' split--tinted' : '' ?>" id="<?= e($section['id']) ?>">
|
||||
<section class="section split<?= $flip ? ' split--flip' : '' ?><?= $tinted ? ' section--tinted' : '' ?>" id="<?= e($section['id']) ?>">
|
||||
<div class="container split__inner">
|
||||
<div class="split__text">
|
||||
<h<?= $level ?>><?= e($section['title']) ?></h<?= $level ?>>
|
||||
|
||||
Reference in New Issue
Block a user