public function renderBody()
{
$groupsProperty = new ReflectionProperty(Nette\Forms\Form::class, 'groups');
$groupsProperty->setAccessible(TRUE);
$groups = $groupsProperty->getValue($this->form);
$this->groups = $this->containers = [];
$groupsProperty->setValue($this->form, array_filter($groups, function (Nette\Forms\ControlGroup $group, $key) {
if (!$group->getControls() || !$group->getOption('visual')) {
return FALSE;
}
$this->groups[$key] = ['group' => $group, 'body' => $body = $this->renderControls($group), 'key' => $key];
return $body;
}, ARRAY_FILTER_USE_BOTH));
$body = parent::renderBody();
$groupsProperty->setValue($this->form, $groups);
return $body;
}