add( 'name', TextType::class, [ 'label' => 'Name', 'required' => true, 'attr' => [ ], 'constraints' => [ new NotBlank(), ], ] ); $builder->add( 'metaTitle', TextType::class, [ 'label' => 'Title', 'required' => false, 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'metaDescription', TextType::class, [ 'label' => 'Description', 'required' => false, 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'ogTitle', TextType::class, [ 'label' => 'Title', 'required' => false, 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'ogDescription', TextType::class, [ 'label' => 'Description', 'required' => false, 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'ogImage', FileType::class, [ 'label' => 'Image', 'required' => false, 'attr' => [ ], 'constraints' => [ new Image(), ], ] ); $builder->add( 'template', ChoiceType::class, [ 'label' => 'Render', 'required' => true, 'choices' => call_user_func(function () use ($options) { $choices = []; foreach ($options['pageConfiguration']->getTemplates() as $template) { $choices[$template['name']] = $template['file']; } return $choices; }), 'attr' => [ ], 'constraints' => [ new NotBlank(), ], ] ); $builder->getData()->buildForm($builder); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => Page::class, 'pageConfiguration' => null, ]); } }