/** * Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid * name clashes if the same fieldset is used multiple times * * @param FieldsetInterface $form * @return mixed|void */ public function prepareElement(FieldsetInterface $form) { $name = $this->getName(); foreach ($this->iterator as $elementOrFieldset) { if ($form->wrapElements()) { $elementOrFieldset->setName($name . '[' . $elementOrFieldset->getName() . ']'); } // Recursively prepare elements if ($elementOrFieldset instanceof ElementPrepareAwareInterface) { $elementOrFieldset->prepareElement($form); } } }