Baue die Verwaltung Kommunikation, die öffentliche Anfrageschnittstelle und das CMS-Widget Anfrage
Anliegen, Feldkatalog, Feldgruppen, Anfragevorlagen mit Fassungen, Anfrage-Einstiege, Posteingang mit Status und Notizen, Einstellungen mit Empfängern. Das Widget speichert nur die Kennung eines veröffentlichten Einstiegs; Formular, Bedingungen und Annahme kommen zur Laufzeit vom Server (Kompaktformular und mehrstufiger Dialog aus derselben Beschreibung). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ee1fc9866
commit
c6a8167601
45 files changed
+5415
No files matched your search
@@ -45,4 +45,45 @@ public static function from(string $label, array $taken = []): string
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ergänzt fehlende oder doppelte Kennungen von Auswahlwerten. Bestehende, gültige Kennungen bleiben unverändert,
|
||||
* damit gespeicherte Antworten und Bedingungen gültig bleiben, auch wenn eine Bezeichnung umbenannt wird.
|
||||
*
|
||||
* @param array<int|string, mixed> $options
|
||||
* @return list<array{key: string, label: string}>
|
||||
*/
|
||||
public static function withKeys(array $options): array
|
||||
{
|
||||
$result = [];
|
||||
$taken = [];
|
||||
|
||||
foreach ($options as $option) {
|
||||
$key = is_array($option) ? ($option['key'] ?? null) : null;
|
||||
|
||||
if (self::valid($key) && ! in_array($key, $taken, true)) {
|
||||
$taken[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($options as $option) {
|
||||
$option = is_array($option) ? $option : [];
|
||||
$label = trim((string) ($option['label'] ?? ''));
|
||||
|
||||
if ($label === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$key = $option['key'] ?? null;
|
||||
|
||||
if (! self::valid($key) || in_array($key, array_column($result, 'key'), true)) {
|
||||
$key = self::from($label, array_merge($taken, array_column($result, 'key')));
|
||||
$taken[] = $key;
|
||||
}
|
||||
|
||||
$result[] = ['key' => $key, 'label' => mb_substr($label, 0, 120)];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user