neos / form

Flow Form Framework
https://flow-form-framework.readthedocs.org/en/latest/
MIT License
15 stars 36 forks source link

listForms method in YamlPersistenceManager triggers warning when index is not found #26

Closed laurisaarni closed 7 years ago

laurisaarni commented 7 years ago

The listForms method in YamlPersistenceManager triggers warning when the index is not found in the array containing settings from a YAML file.

In our case ContactForm.yaml is located in Packages/Sites/WE.SitePackage/Configuration which contains other non form setting YAML files as well.

When the code tries to access $form['identifier'] on line 105 it causes index not found warning what will be displayed in the Neos backend.

Suggested fix: add type check before access the $form array:

            if (!key_exists('type', $form) && $form['type'] === 'TYPO3.Form:Form'){
                $forms[] = array(
                    'identifier' => $form['identifier'],
                    'name' => isset($form['label']) ? $form['label'] : $form['identifier'],
                    'persistenceIdentifier' => $persistenceIdentifier
                );
            }
kdambekalns commented 7 years ago

I usually put all forms into their own directory… :)

bwaidelich commented 7 years ago

I suggest to go for the solution, Karsten pointed out. Checking for "TYPO3.Form:Form" (or "Neos.Form:Form" for that matter) won't work because that type can be changed.