Skip to content

Commit

Permalink
[TASK] Expose submitButtonLabel from editor in json form response (#773)
Browse files Browse the repository at this point in the history
Resolves: #767
  • Loading branch information
twoldanski authored Sep 13, 2024
1 parent 005b867 commit c6bc20a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/Form/Decorator/AbstractFormDefinitionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ public function __invoke(array $definition, int $currentPage): array
{
$decorated = [];

$this->formId = $definition['identifier'];
$pageElements = $definition['renderables'][$currentPage]['renderables'] ?? [];
$submitLabel = $definition['renderingOptions']['submitButtonLabel'] ?? '';
$submitLabelFromEditor = [];

$this->formId = $definition['identifier'];
if ($submitLabel !== '') {
$submitLabelFromEditor = ['submitButtonLabel' => $submitLabel];
}

$decorated['id'] = $this->formId;
$decorated['api'] = $this->formStatus;
$decorated['i18n'] = $definition['i18n']['properties'] ?? [];
$decorated['i18n'] = [...$submitLabelFromEditor, ...($definition['i18n']['properties'] ?? [])];
$decorated['elements'] = $this->handleRenderables($pageElements);

return $this->overrideDefinition($decorated, $definition, $currentPage);
Expand Down

0 comments on commit c6bc20a

Please sign in to comment.