Skip to content

Commit

Permalink
FEATURE: Invoke onSubmit callback on pages
Browse files Browse the repository at this point in the history
Form Pages are an instance of `AbstractSection` but their `onSubmit()`
callback was never invoked by the Form Framework.

Resolves: #148
  • Loading branch information
bwaidelich committed Aug 6, 2021
1 parent f5f446d commit 3be0655
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Core/Runtime/FormRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,18 @@ protected function mapAndValidatePage(Page $page)
}
};

$pageFormValues = [];
foreach ($page->getElementsRecursively() as $element) {
$value = Arrays::getValueByPath($requestArguments, $element->getIdentifier());
$element->onSubmit($this, $value);

$this->formState->setFormValue($element->getIdentifier(), $value);
$pageFormValues[$element->getIdentifier()] = $value;
$registerPropertyPaths($element->getIdentifier());
}
$page->onSubmit($this, $pageFormValues);
foreach ($pageFormValues as $elementIdentifier => $value) {
$this->formState->setFormValue($elementIdentifier, $value);
}

// The more parts the path has, the more early it is processed
usort($propertyPathsForWhichPropertyMappingShouldHappen, function ($a, $b) {
Expand Down

0 comments on commit 3be0655

Please sign in to comment.