]>
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\FormBuilderInterface; | |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | |
10 | ||
11 | class NewTagType extends AbstractType | |
12 | { | |
13 | public function buildForm(FormBuilderInterface $builder, array $options) | |
14 | { | |
15 | $builder | |
16 | ->add('label', TextType::class, [ | |
17 | 'required' => true, | |
18 | 'attr' => [ | |
19 | 'placeholder' => 'tag.new.placeholder', | |
20 | ], | |
21 | ]) | |
22 | ->add('add', SubmitType::class, [ | |
23 | 'label' => 'tag.new.add', | |
24 | ]) | |
25 | ; | |
26 | } | |
27 | ||
28 | public function configureOptions(OptionsResolver $resolver) | |
29 | { | |
30 | $resolver->setDefaults([ | |
31 | 'data_class' => 'Wallabag\CoreBundle\Entity\Tag', | |
32 | ]); | |
33 | } | |
34 | ||
35 | public function getBlockPrefix() | |
36 | { | |
37 | return 'tag'; | |
38 | } | |
39 | } |