I have $form and some fields in the different tabs, that works okay, I want to add a field into the form
$this->getSubject()->getId()
if this condition is not NULL
What I did, after defining form that should be visible in all conditions i added this part of code, to add field url in the tab dimension (tab dimension is already added in previous formmapper definition):
if($this->getSubject()->getId() !== NULL){
$formMapper
->with('tab.dimension')
->add(
'url',
null,
[
'required' => false,
]
)
->end();
}
But the error i recive is:
New tab was added automatically when you have added field or group. You should close current tab before adding new one OR add tabs before adding groups and fields.
Any help?
CodePudding user response:
use Tab like this If you want to add groupping than use With
function.
if($this->getSubject()->getId() !== NULL) { $formMapper ->tab('dimension') ->add('url', null, [ 'required' => false, ]) ->end(); }