protected function renderFormRow(FormInterface $form, FormRenderTemplateInterface $template, $variableName) { $html = ''; /** @var FormInterface $child */ foreach ($form->getIterator() as $child) { $childName = $variableName . '.' . $child->getName(); if ($this->isExpanded($child)) { $html .= $this->renderFormRow($child, $template, $childName); } else { $html .= $template->renderFormRow($form, $variableName, $childName, ucfirst($child->getName())); } } return $html; }