Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 0e97a63

Browse files
authored
Merge pull request #269 from symfony-cmf/fix_burgov
Fix Symfony 3 compat in admin extensions
2 parents 6b2c4b9 + 228bcd7 commit 0e97a63

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

Admin/Extension/MenuNodeReferrersExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Sonata\AdminBundle\Admin\AdminExtension;
1515
use Sonata\AdminBundle\Form\FormMapper;
16+
use Sonata\CoreBundle\Form\Type\CollectionType;
1617

1718
/**
1819
* Admin extension to add menu items tab to content.
@@ -29,7 +30,7 @@ public function configureFormFields(FormMapper $formMapper)
2930
))
3031
->add(
3132
'menuNodes',
32-
'sonata_type_collection',
33+
CollectionType::class,
3334
array(),
3435
array(
3536
'edit' => 'inline',

Admin/Extension/MenuOptionsExtension.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
namespace Symfony\Cmf\Bundle\MenuBundle\Admin\Extension;
1313

14+
use Burgov\Bundle\KeyValueFormBundle\Form\Type\KeyValueType;
1415
use Sonata\AdminBundle\Admin\AdminExtension;
1516
use Sonata\AdminBundle\Form\FormMapper;
17+
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
18+
use Symfony\Component\Form\Extension\Core\Type\TextType;
1619

1720
/**
1821
* Admin extension for editing menu options
@@ -52,13 +55,13 @@ public function configureFormFields(FormMapper $formMapper)
5255
))
5356
->add(
5457
'display',
55-
'checkbox',
58+
CheckboxType::class,
5659
array('required' => false),
5760
array('help' => 'form.help_display')
5861
)
5962
->add(
6063
'displayChildren',
61-
'checkbox',
64+
CheckboxType::class,
6265
array('required' => false),
6366
array('help' => 'form.help_display_children')
6467
)
@@ -69,7 +72,7 @@ public function configureFormFields(FormMapper $formMapper)
6972
}
7073

7174
$child_options = array(
72-
'value_type' => 'text',
75+
'value_type' => TextType::class,
7376
'label' => false,
7477
'attr' => array('style' => 'clear:both'),
7578
);
@@ -79,38 +82,38 @@ public function configureFormFields(FormMapper $formMapper)
7982
))
8083
->add(
8184
'attributes',
82-
'burgov_key_value',
85+
KeyValueType::class,
8386
array(
84-
'value_type' => 'text',
87+
'value_type' => TextType::class,
8588
'required' => false,
86-
'options' => $child_options,
89+
'entry_options' => $child_options,
8790
)
8891
)
8992
->add(
9093
'labelAttributes',
91-
'burgov_key_value',
94+
KeyValueType::class,
9295
array(
93-
'value_type' => 'text',
96+
'value_type' => TextType::class,
9497
'required' => false,
95-
'options' => $child_options,
98+
'entry_options' => $child_options,
9699
)
97100
)
98101
->add(
99102
'childrenAttributes',
100-
'burgov_key_value',
103+
KeyValueType::class,
101104
array(
102-
'value_type' => 'text',
105+
'value_type' => TextType::class,
103106
'required' => false,
104-
'options' => $child_options,
107+
'entry_options' => $child_options,
105108
)
106109
)
107110
->add(
108111
'linkAttributes',
109-
'burgov_key_value',
112+
KeyValueType::class,
110113
array(
111-
'value_type' => 'text',
114+
'value_type' => TextType::class,
112115
'required' => false,
113-
'options' => $child_options,
116+
'entry_options' => $child_options,
114117
)
115118
)
116119
->end();

0 commit comments

Comments
 (0)