]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | namespace Wallabag\CoreBundle\Form\Type; | |
4 | ||
5 | use Symfony\Component\Form\AbstractType; | |
6 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
7 | use Symfony\Component\Form\Extension\Core\Type\TextType; | |
8 | use Symfony\Component\Form\Extension\Core\Type\UrlType; | |
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('url', UrlType::class, [ | |
22 | 'disabled' => true, | |
23 | 'required' => false, | |
24 | 'label' => 'entry.edit.url_label', | |
25 | 'default_protocol' => null, | |
26 | ]) | |
27 | ->add('origin_url', UrlType::class, [ | |
28 | 'required' => false, | |
29 | 'property_path' => 'originUrl', | |
30 | 'label' => 'entry.edit.origin_url_label', | |
31 | 'default_protocol' => null, | |
32 | ]) | |
33 | ->add('save', SubmitType::class, [ | |
34 | 'label' => 'entry.edit.save_label', | |
35 | ]) | |
36 | ; | |
37 | } | |
38 | ||
39 | public function configureOptions(OptionsResolver $resolver) | |
40 | { | |
41 | $resolver->setDefaults([ | |
42 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', | |
43 | ]); | |
44 | } | |
45 | ||
46 | public function getBlockPrefix() | |
47 | { | |
48 | return 'entry'; | |
49 | } | |
50 | } |