1111
1212namespace Symfony \Cmf \Bundle \MenuBundle \Admin ;
1313
14+ use Symfony \Component \Form \Extension \Core \Type \TextType ;
1415use Symfony \Component \Form \FormEvent ;
1516use Symfony \Component \Form \FormEvents ;
17+ use Symfony \Cmf \Bundle \MenuBundle \Model \MenuNode ;
1618use Sonata \AdminBundle \Datagrid \ListMapper ;
1719use 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 ;
1922use Knp \Menu \ItemInterface as MenuItemInterface ;
2023use Doctrine \Common \Util \ClassUtils ;
2124
@@ -40,7 +43,7 @@ protected function configureFormFields(FormMapper $formMapper)
4043 {
4144 $ formMapper
4245 ->with ('form.group_general ' )
43- ->add ('parent ' , ' doctrine_phpcr_odm_tree ' , array (
46+ ->add ('parent ' , TreeModelType::class , array (
4447 'root_node ' => $ this ->menuRoot ,
4548 'choice_list ' => array (),
4649 'select_root_node ' => true ,
@@ -54,7 +57,7 @@ protected function configureFormFields(FormMapper $formMapper)
5457 // Add the choice for the node links "target"
5558 $ formMapper
5659 ->with ('form.group_general ' )
57- ->add ('linkType ' , ' choice_field_mask ' , array (
60+ ->add ('linkType ' , ChoiceFieldMaskType::class , array (
5861 'choices ' => array (
5962 'route ' => 'route ' ,
6063 'uri ' => 'uri ' ,
@@ -63,13 +66,13 @@ protected function configureFormFields(FormMapper $formMapper)
6366 'map ' => array (
6467 'route ' => array ('link ' ),
6568 'uri ' => array ('link ' ),
66- 'content ' => array ('content ' , ' doctrine_phpcr_odm_tree ' ),
69+ 'content ' => array ('content ' , TreeModelType::class ),
6770 ),
68- 'empty_value ' => 'auto ' ,
71+ 'placeholder ' => 'auto ' ,
6972 'required ' => false ,
7073 ))
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 ,
7376 array (
7477 'root_node ' => $ this ->contentRoot ,
7578 'choice_list ' => array (),
@@ -159,15 +162,13 @@ public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
159162 {
160163 $ menuNodeNode = parent ::buildBreadcrumbs ($ action , $ menu );
161164
162- if ($ action != ' edit ' || !$ this ->recursiveBreadcrumbs ) {
165+ if (' edit ' !== $ action || !$ this ->recursiveBreadcrumbs ) {
163166 return $ menuNodeNode ;
164167 }
165168
166169 $ parentDoc = $ this ->getSubject ()->getParentDocument ();
167170 $ pool = $ this ->getConfigurationPool ();
168- $ parentAdmin = $ pool ->getAdminByClass (
169- ClassUtils::getClass ($ parentDoc )
170- );
171+ $ parentAdmin = $ pool ->getAdminByClass (ClassUtils::getClass ($ parentDoc ));
171172
172173 if (null === $ parentAdmin ) {
173174 return $ menuNodeNode ;
0 commit comments