@@ -29,14 +29,17 @@ public function registerBundles()
29
29
Usage
30
30
-----
31
31
32
- To add to your form, use the alias ` burgov_key_value ` :
32
+ To add to your form, use the ` KeyValueType ` type :
33
33
34
34
``` php
35
- $builder->add('parameters', 'burgov_key_value', array('value_type' => 'text'));
35
+ use Burgov\Bundle\KeyValueFormBundle\Form\Type\KeyValueType;
36
+ use Symfony\Component\Form\Extension\Core\Type\TextType;
37
+
38
+ $builder->add('parameters', KeyValueType::class, array('value_type' => TextType::class));
36
39
37
40
// or
38
41
39
- $formFactory->create('burgov_key_value' , $data, array('value_type' => 'text' ));
42
+ $formFactory->create(KeyValueType::class , $data, array('value_type' => TextType::class ));
40
43
```
41
44
42
45
The type extends the collection type, so for rendering it in the browser, the same logic is used. See the
@@ -53,7 +56,7 @@ The type adds four options to the collection type options, of which one is requi
53
56
* ` use_container_object ` see explanation below at 'The KeyValueCollection'
54
57
55
58
Besides that, this type overrides some defaults of the collection type and it's recommended you don't change them:
56
- ` type ` is set to ` burgov_key_value_row ` and ` allow_add ` and ` allow_delete ` are always ` true ` .
59
+ ` type ` is set to ` BurgovKeyValueRow::class ` and ` allow_add ` and ` allow_delete ` are always ` true ` .
57
60
58
61
Working with SonataAdminBundle
59
62
------------------------------
@@ -93,7 +96,7 @@ it, you need to set the `use_container_object` option on the form type to
93
96
/** @var $builder Symfony\Component\Form\FormBuilderInterface */
94
97
$builder->add('options', 'burgov_key_value', array(
95
98
'required' => false,
96
- 'value_type' => 'text' ,
99
+ 'value_type' => TextType::class ,
97
100
'use_container_object' => true,
98
101
));
99
102
```
0 commit comments