11
11
12
12
namespace Symfony \Cmf \Bundle \MenuBundle \Admin ;
13
13
14
+ use Symfony \Component \Form \Extension \Core \Type \TextType ;
14
15
use Symfony \Component \Form \FormEvent ;
15
16
use Symfony \Component \Form \FormEvents ;
17
+ use Symfony \Cmf \Bundle \MenuBundle \Model \MenuNode ;
16
18
use Sonata \AdminBundle \Datagrid \ListMapper ;
17
19
use Sonata \AdminBundle \Form \FormMapper ;
18
- use Symfony \Cmf \Bundle \MenuBundle \Model \MenuNode ;
20
+ use Sonata \DoctrinePHPCRAdminBundle \Form \Type \ChoiceFieldMaskType ;
21
+ use Sonata \DoctrinePHPCRAdminBundle \Form \Type \TreeModelType ;
19
22
use Knp \Menu \ItemInterface as MenuItemInterface ;
20
23
use Doctrine \Common \Util \ClassUtils ;
21
24
@@ -40,7 +43,7 @@ protected function configureFormFields(FormMapper $formMapper)
40
43
{
41
44
$ formMapper
42
45
->with ('form.group_general ' )
43
- ->add ('parent ' , ' doctrine_phpcr_odm_tree ' , array (
46
+ ->add ('parent ' , TreeModelType::class , array (
44
47
'root_node ' => $ this ->menuRoot ,
45
48
'choice_list ' => array (),
46
49
'select_root_node ' => true ,
@@ -54,7 +57,7 @@ protected function configureFormFields(FormMapper $formMapper)
54
57
// Add the choice for the node links "target"
55
58
$ formMapper
56
59
->with ('form.group_general ' )
57
- ->add ('linkType ' , ' choice_field_mask ' , array (
60
+ ->add ('linkType ' , ChoiceFieldMaskType::class , array (
58
61
'choices ' => array (
59
62
'route ' => 'route ' ,
60
63
'uri ' => 'uri ' ,
@@ -63,13 +66,13 @@ protected function configureFormFields(FormMapper $formMapper)
63
66
'map ' => array (
64
67
'route ' => array ('link ' ),
65
68
'uri ' => array ('link ' ),
66
- 'content ' => array ('content ' , ' doctrine_phpcr_odm_tree ' ),
69
+ 'content ' => array ('content ' , TreeModelType::class ),
67
70
),
68
- 'empty_value ' => 'auto ' ,
71
+ 'placeholder ' => 'auto ' ,
69
72
'required ' => false ,
70
73
))
71
- ->add ('link ' , ' text ' , array ('required ' => false , 'mapped ' => false ))
72
- ->add ('content ' , ' doctrine_phpcr_odm_tree ' ,
74
+ ->add ('link ' , TextType::class , array ('required ' => false , 'mapped ' => false ))
75
+ ->add ('content ' , TreeModelType::class ,
73
76
array (
74
77
'root_node ' => $ this ->contentRoot ,
75
78
'choice_list ' => array (),
@@ -159,15 +162,13 @@ public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
159
162
{
160
163
$ menuNodeNode = parent ::buildBreadcrumbs ($ action , $ menu );
161
164
162
- if ($ action != ' edit ' || !$ this ->recursiveBreadcrumbs ) {
165
+ if (' edit ' !== $ action || !$ this ->recursiveBreadcrumbs ) {
163
166
return $ menuNodeNode ;
164
167
}
165
168
166
169
$ parentDoc = $ this ->getSubject ()->getParentDocument ();
167
170
$ pool = $ this ->getConfigurationPool ();
168
- $ parentAdmin = $ pool ->getAdminByClass (
169
- ClassUtils::getClass ($ parentDoc )
170
- );
171
+ $ parentAdmin = $ pool ->getAdminByClass (ClassUtils::getClass ($ parentDoc ));
171
172
172
173
if (null === $ parentAdmin ) {
173
174
return $ menuNodeNode ;
0 commit comments