Skip to content

Commit

Permalink
Merge pull request #149 from neos/feature/148-onSubmit-for-pages
Browse files Browse the repository at this point in the history
FEATURE: Invoke onSubmit callback on pages
  • Loading branch information
daniellienert authored Mar 29, 2022
2 parents ed43392 + 3be0655 commit 800b0f5
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 800b0f5

Please sign in to comment.