add('accept', CheckboxType::class, [ 'label' => 'I accept the terms of service', 'attr' => [ 'align_with_widget' => true ], 'constraints' => [ new IsTrue([ 'message' => 'You must accept the terms of service.' ]) ] ]); } /** * * {@inheritdoc} * @see \Symfony\Component\Form\AbstractType::configureOptions() */ public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver) { $resolver->setDefined('url') ->setRequired('url') ->addAllowedTypes('url', 'string') ->setDefault('label', false); } }