1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Cdf\BiCoreBundle\Form; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Form\AbstractType; |
6
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
7
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
9
|
|
|
use Cdf\BiCoreBundle\Entity\Menuapplicazione; |
10
|
|
|
use Cdf\BiCoreBundle\Form\Datatransformer\MenuapplicazioneTransformer; |
11
|
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
12
|
|
|
|
13
|
|
|
class MenuapplicazioneType extends AbstractType |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
private $transformer; |
17
|
|
|
|
18
|
1 |
|
public function __construct(MenuapplicazioneTransformer $transformer) |
19
|
|
|
{ |
20
|
1 |
|
$this->transformer = $transformer; |
21
|
1 |
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param FormBuilderInterface $builder |
25
|
|
|
* @param array $options |
26
|
|
|
*/ |
27
|
1 |
|
public function buildForm(FormBuilderInterface $builder, array $options) |
28
|
|
|
{ |
29
|
|
|
$submitparms = array( |
30
|
1 |
|
'label' => 'Aggiorna record', |
31
|
|
|
'attr' => array( |
32
|
|
|
'class' => 'btn-outline-primary bisubmit', |
33
|
|
|
'aria-label' => 'Aggiorna record', |
34
|
|
|
),); |
35
|
|
|
$builder |
36
|
1 |
|
->add('nome') |
37
|
1 |
|
->add('percorso') |
38
|
1 |
|
->add('padre', EntityType::class, [ |
39
|
1 |
|
'class' => Menuapplicazione::class, |
40
|
|
|
// validation message if the data transformer fails |
41
|
|
|
'invalid_message' => 'Padre non valido', |
42
|
|
|
'required' => false |
43
|
|
|
]) |
44
|
1 |
|
->add('ordine') |
45
|
1 |
|
->add('attivo') |
46
|
1 |
|
->add('target') |
47
|
1 |
|
->add('tag') |
48
|
1 |
|
->add('notifiche') |
49
|
1 |
|
->add('autorizzazionerichiesta') |
50
|
1 |
|
->add('percorsonotifiche') |
51
|
1 |
|
->add('submit', SubmitType::class, $submitparms); |
52
|
|
|
|
53
|
1 |
|
$builder->get('padre')->addModelTransformer($this->transformer); |
54
|
1 |
|
} |
55
|
|
|
|
56
|
1 |
|
public function configureOptions(OptionsResolver $resolver) |
57
|
|
|
{ |
58
|
1 |
|
$resolver->setDefaults([ |
59
|
1 |
|
'data_class' => Menuapplicazione::class, |
60
|
|
|
'parametriform' => array(), |
61
|
|
|
]); |
62
|
1 |
|
} |
63
|
|
|
} |
64
|
|
|
|