]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
Fix display the form errors correctly
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / EditEntryType.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Form\Type;
4
5 use Symfony\Component\Form\AbstractType;
6 use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
7 use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8 use Symfony\Component\Form\Extension\Core\Type\TextType;
9 use Symfony\Component\Form\FormBuilderInterface;
10 use Symfony\Component\OptionsResolver\OptionsResolver;
11
12 class EditEntryType extends AbstractType
13 {
14 public function buildForm(FormBuilderInterface $builder, array $options)
15 {
16 $builder
17 ->add('title', TextType::class, [
18 'required' => true,
19 'label' => 'entry.edit.title_label',
20 ])
21 ->add('is_public', CheckboxType::class, [
22 'required' => false,
23 'label' => 'entry.edit.is_public_label',
24 'property_path' => 'isPublic',
25 ])
26 ->add('url', TextType::class, [
27 'disabled' => true,
28 'required' => false,
29 'label' => 'entry.edit.url_label',
30 ])
31 ->add('save', SubmitType::class, [
32 'label' => 'entry.edit.save_label',
33 ])
34 ;
35 }
36
37 public function configureOptions(OptionsResolver $resolver)
38 {
39 $resolver->setDefaults([
40 'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
41 ]);
42 }
43
44 public function getBlockPrefix()
45 {
46 return 'entry';
47 }
48 }