]>
Commit | Line | Data |
---|---|---|
5847dd35 TC |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Form\Type; | |
4 | ||
5 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |
6 | use Symfony\Component\Form\AbstractType; | |
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
8 | use Symfony\Component\Form\FormBuilderInterface; | |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | |
10 | use Wallabag\CoreBundle\Entity\Entry; | |
11 | use Wallabag\GroupBundle\Entity\Group; | |
12 | ||
13 | class EditGroupSharesType extends AbstractType | |
14 | { | |
15 | public function buildForm(FormBuilderInterface $builder, array $options) | |
16 | { | |
17 | $builder | |
18 | ->add('groupshares', EntityType::class, [ | |
19 | 'required' => true, | |
20 | 'class' => Group::class, | |
21 | 'choices' => $options['groups'], | |
22 | 'multiple' => true, | |
23 | 'expanded' => true, | |
24 | ]) | |
25 | ->add('save', SubmitType::class, [ | |
26 | 'label' => 'Share', | |
27 | ]) | |
28 | ; | |
29 | } | |
30 | ||
31 | public function configureOptions(OptionsResolver $resolver) | |
32 | { | |
33 | $resolver->setDefaults([ | |
34 | 'data_class' => Entry::class, | |
35 | ]); | |
36 | $resolver->setRequired('groups'); | |
37 | } | |
38 | ||
39 | public function getBlockPrefix() | |
40 | { | |
41 | return 'group_shares'; | |
42 | } | |
43 | } |