Skip to content

Commit

Permalink
feat: output form checkbox links in description and allow positional …
Browse files Browse the repository at this point in the history
…parameters
  • Loading branch information
dvdmlln committed Nov 5, 2024
1 parent 2e2c092 commit dc3b7cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Classes/Form/FormDefinitionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ private function setCheckboxLinks(array &$element): void
$element['type'] === 'Checkbox' &&
isset($element['properties']['links'])
) {
foreach ($element['properties']['links'] as $pageUid => $label) {
$links = array_map(function ($pageUid, $label) {
$link = $this->cObj->createLink($label, ['parameter' => $pageUid]);
if ($link instanceof LinkResult) {
$element['label'] = sprintf($element['label'], $link->getHtml());
}
return $link instanceof LinkResult ? $link->getHtml() : null;
}, array_keys($element['properties']['links']), $element['properties']['links']);

$element['label'] = sprintf($element['label'], ...$links);
if (isset($element['properties']['elementDescription'])) {
$element['properties']['elementDescription'] = sprintf($element['properties']['elementDescription'], ...$links);
}

unset($element['properties']['links']);
}
}
Expand Down

0 comments on commit dc3b7cd

Please sign in to comment.