modify() public method

For example, the AbstractFormContainer supports passing "fields" and each field is then attempted fetched from children. If not found, it is created (and the structure passed to the create() function which uses the same structure syntax). If it already exists, the modify() method is called on that object to trigger the recursive modification of all child components.
public modify ( array $structure ) : FluidTYPO3\Flux\Form\FormInterface
$structure array
return FluidTYPO3\Flux\Form\FormInterface
Beispiel #1
0
 /**
  * @param array $structure
  * @return ContainerInterface
  */
 public function modify(array $structure)
 {
     if (TRUE === isset($structure['wizards'])) {
         foreach ((array) $structure['wizards'] as $index => $wizardData) {
             $wizardName = TRUE === isset($wizardData['name']) ? $wizardData['name'] : $index;
             // check if field already exists - if it does, modify it. If it does not, create it.
             if (TRUE === $this->has($wizardName)) {
                 $field = $this->get($wizardName);
             } else {
                 $wizardType = TRUE === isset($wizardData['type']) ? $wizardData['type'] : 'None';
                 $field = $this->createWizard($wizardType, $wizardName);
             }
             $field->modify($wizardData);
         }
     }
     return parent::modify($structure);
 }