You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In EXT:form it is possible for Values in the $valuesWithPages, to have multiple Levels.
This would cause those Variables to not be set in the returned Value of getFormValues(). (SaveFormToDatabaseFinisher.php)
If you want to reproduce this problem, you can try using the "repeatable container" form extension for typo3.
To fix this, we have to traverse the given path, which has dots in it, through the array.
With this simple Function, this works:
protectedfunctiontraversePath($conf, $path) {
// We split each word seperated by a dot character$paths = explode('.', $path);
$result = $conf;
foreach ($pathsas$path) {
$result = $result[$path];
}
return$result;
}
/** * Returns the values of the submitted form * * @return [] */protectedfunctiongetFormValues(): array
{
// All values, with pages$valuesWithPages = $this->finisherContext->getFormValues();
$values = [];
// Goes trough all form-pages - and there trough all PageElements (Questions)foreach ($this->finisherContext->getFormRuntime()->getPages() as$page) {
foreach ($page->getElementsRecursively() as$pageElem) {
if ($pageElem->getType() !== 'Honeypot') {
if($pageElem->getType() !== 'FileUpload' && $pageElem->getType() !== 'ImageUpload'){
$values[$pageElem->getIdentifier()]['value'] = $this->traversePath($valuesWithPages, $pageElem->getIdentifier());
}else{
if($valuesWithPages[$pageElem->getIdentifier()]){
$values[$pageElem->getIdentifier()]['value'] = $valuesWithPages[$pageElem->getIdentifier()]->getOriginalResource()->getName();
}
}
$values[$pageElem->getIdentifier()]['conf']['label'] = $pageElem->getLabel();
$values[$pageElem->getIdentifier()]['conf']['inputType'] = $pageElem->getType();
}
}
}
return$values;
}
The text was updated successfully, but these errors were encountered:
In EXT:form it is possible for Values in the $valuesWithPages, to have multiple Levels.
This would cause those Variables to not be set in the returned Value of getFormValues(). (SaveFormToDatabaseFinisher.php)
If you want to reproduce this problem, you can try using the "repeatable container" form extension for typo3.
To fix this, we have to traverse the given path, which has dots in it, through the array.
With this simple Function, this works:
The text was updated successfully, but these errors were encountered: