I have found a resolution to this, but it isn't very elegant:
$groups = $formMapper->getAdmin()->getFormGroups();
unset($groups['groupname']);
$formMapper->getAdmin()->setFormGroups($groups);
A better solution is more then welcome.
Question
I am having problems extending the UserAdmin
and removing a FormGroup
within the configureFormFields
method.
I can remove fields using:
public function configureListFields(FormMapper $formMapper)
{
$formMapper
->with('Profile')
->remove('locale')
->end()
;
}
If I remove all fields under Profile
, it still shows as a header.
I tried removing Profile
doing:
$formMapper
->remove('Profile')
;
But this does not work - after some research it seems remove only looks at the chidren and not the FormGroups. What is the correct way to remove a FormGroup from the formatter so it isn't shown anymore?
Solution
I have found a resolution to this, but it isn't very elegant:
$groups = $formMapper->getAdmin()->getFormGroups();
unset($groups['groupname']);
$formMapper->getAdmin()->setFormGroups($groups);
A better solution is more then welcome.