Skip to content
Snippets Groups Projects
Commit 721e2e3e authored by Marc Egger's avatar Marc Egger
Browse files

make better exception

parent 91cf36a5
No related branches found
No related tags found
2 merge requests!302Develop,!296Marc: Form/Report As File, Path class, Config class, Typo3 v9 compatability
Pipeline #3951 failed
......@@ -622,6 +622,7 @@ class FormAsFile
// Remove columns: id, name, fileStats
$formId = $form[F_ID];
$formName = $form[F_NAME];
unset($form[F_ID]);
unset($form[F_NAME]);
unset($form[F_FILE_STATS]);
......@@ -631,12 +632,12 @@ class FormAsFile
$formElements = $database->sql($sql, ROW_REGULAR, $parameterArray); // array(array(column name => value))
// Translate container references (id to name) and remove all id columns
$containerNames = array_reduce($formElements, function ($result, $formElement) {
$containerNames = array_reduce($formElements, function ($result, $formElement) use ($formName) {
if ($formElement[FE_CLASS] === FE_CLASS_CONTAINER) {
$containerName = $formElement[FE_NAME];
if (in_array($containerName, $result) || $containerName === '') {
throw new \UserFormException(json_encode([
ERROR_MESSAGE_TO_USER => 'Duplicate container names.',
ERROR_MESSAGE_TO_USER => "Duplicate container names in form $formName",
ERROR_MESSAGE_TO_DEVELOPER => "Container Form Elements must have a unique and nonempty name. Container name: '$containerName'."]),
ERROR_FORM_INVALID_NAME);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment