Do not show a unecessary label in front of the boolean constraint types checkboxes

This commit is contained in:
Jan Böhmer 2023-04-08 01:24:17 +02:00
parent d258235430
commit 363b7bc314

View file

@ -24,6 +24,8 @@ use App\DataTables\Filters\Constraints\BooleanConstraint;
use App\Form\Type\TriStateCheckboxType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class BooleanConstraintType extends AbstractType
@ -43,4 +45,10 @@ class BooleanConstraintType extends AbstractType
'required' => false,
]);
}
public function finishView(FormView $view, FormInterface $form, array $options)
{
//Remove the label from the compound form, as the checkbox already has a label
$view->vars['label'] = false;
}
}