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

Commit bcf561a

Browse files
committed
cleanup form_group and form_tab doc
1 parent e5f44ed commit bcf561a

File tree

6 files changed

+270
-76
lines changed

6 files changed

+270
-76
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The name of the form group to use in the admin extension.
2+
3+
The caption for the group is determined by translating the group name. If you
4+
change the group, be sure to also define a translation for it.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The name of the form tab to use in the admin extension.
2+
3+
The caption for the tab is determined by translating the tab name. If you
4+
change the tab name, be sure to also define a translation for it.

bundles/sonata_phpcr_admin_integration/core.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,14 @@ admins as needed - see below for details.
8282

8383
**type**: ``string`` **default**: as in above example.
8484

85-
Defines which form group the fields from this extension will appear in within
86-
the Sonata Admin edit interface.
87-
88-
The caption for the group is determined by translating the group name. If you
89-
change the group, be sure to also define a translation for it.
85+
.. include:: ../_partials/sonata_admin_form_group.rst.inc
9086

9187
``form_tab``
9288
~~~~~~~~~~~~
9389

9490
**type**: ``string`` **default**: as in above example.
9591

96-
Defines which form tab the fields from this extension will appear in within
97-
the Sonata Admin edit interface.
98-
99-
The caption for the tab is determined by translating the tab name. If you
100-
change the tab name, be sure to also define a translation for it.
92+
.. include:: ../_partials/sonata_admin_form_tab.rst.inc
10193

10294
Using Child Models: The Child Sonata Admin Extension
10395
----------------------------------------------------

bundles/sonata_phpcr_admin_integration/menu.rst

Lines changed: 186 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,89 @@ MenuNodeReferrersInterface Sonata Admin Extension
6868
The menu admin integration provides an extension to edit referring menu nodes
6969
for content that implements the ``MenuNodeReferrersInterface``.
7070

71-
To enable the extension in your admin classes, define the extension in the
71+
The extension can be separately disabled and you can define the form group and
72+
tab to be used by the field this extension adds:
73+
74+
.. configuration-block::
75+
76+
.. code-block:: yaml
77+
78+
# app/config/config.yml
79+
cmf_sonata_phpcr_admin_integration:
80+
bundles:
81+
menu:
82+
extensions:
83+
menu_node_referrers:
84+
enabled: true
85+
form_group: form.group_menus
86+
form_tab: form.tab_menu
87+
88+
.. code-block:: xml
89+
90+
<!-- app/config/config.xml -->
91+
<?xml version="2.0" encoding="UTF-8" ?>
92+
<container xmlns="http://symfony.com/schema/dic/services"
93+
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
94+
xsd:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
95+
http://cmf.symfony.com/schema/dic/sonata_admin_integration http://cmf.symfony.com/schema/dic/sonata_admin_integration/sonata_admin_integration.xsd"
96+
>
97+
98+
<config xmlns="http://cmf.symfony.com/schema/dic/sonata_admin_integration">
99+
<bundles>
100+
<menu>
101+
<extensions>
102+
<menu-node-referrers
103+
enabled="true"
104+
form-group="form.group_menus"
105+
form-tab="form.tab_menu"
106+
/>
107+
</extensions>
108+
</bundles>
109+
</config>
110+
</container>
111+
112+
.. code-block:: php
113+
114+
// app/config/config.php
115+
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
116+
'bundles' => [
117+
'menu' => [
118+
'extensions' => [
119+
'menu_node_referrers' => [
120+
'enabled' => true,
121+
'form_group' => 'form.group_menus',
122+
'form_tag' => 'form.tab_menu',
123+
],
124+
],
125+
],
126+
],
127+
]);
128+
129+
``enabled``
130+
~~~~~~~~~~~
131+
132+
**type**: ``bool`` **default**: ``true``
133+
134+
If ``false``, the extension is not loaded at all to save resources.
135+
136+
``form_group``
137+
~~~~~~~~~~~~~~
138+
139+
**type**: ``string`` **default**: ``form.group_menus``
140+
141+
.. include:: ../_partials/sonata_admin_form_group.rst.inc
142+
143+
``form_tab``
144+
~~~~~~~~~~~~
145+
146+
**type**: ``string`` **default**: ``form.tab_menu``
147+
148+
.. include:: ../_partials/sonata_admin_form_tab.rst.inc
149+
150+
Using the extension
151+
~~~~~~~~~~~~~~~~~~~
152+
153+
To use the extension in your admin classes, define the extension in the
72154
``sonata_admin`` section of your project configuration:
73155

74156
.. configuration-block::
@@ -122,72 +204,97 @@ MenuOptionInterface Sonata Admin Extension
122204
This menu admin integration provides an extension that allows user to edit
123205
different menu options using the Sonata admin interface.
124206

125-
To enable the extension in your admin classes, define the extension
126-
configuration in the ``sonata_admin`` section of your project configuration:
207+
The extension can be separately disabled and you can define the form group and
208+
tab to be used by the field this extension adds:
127209

128210
.. configuration-block::
129211

130212
.. code-block:: yaml
131213
132214
# app/config/config.yml
133-
sonata_admin:
134-
# ...
135-
extensions:
136-
cmf_sonata_phpcr_admin_integration.menu.extension.menu_options:
137-
implements:
138-
- Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface
215+
cmf_sonata_phpcr_admin_integration:
216+
bundles:
217+
menu:
218+
extensions:
219+
menu_options:
220+
enabled: true
221+
advanced: false
222+
form_group: form.group_menu_options
223+
form_tab: form.tab_general
139224
140225
.. code-block:: xml
141226
142227
<!-- app/config/config.xml -->
143-
<?xml version="1.0" encoding="UTF-8" ?>
144-
<container xmlns="http://cmf.symfony.com/schema/dic/services"
145-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
146-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
228+
<?xml version="2.0" encoding="UTF-8" ?>
229+
<container xmlns="http://symfony.com/schema/dic/services"
230+
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
231+
xsd:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
232+
http://cmf.symfony.com/schema/dic/sonata_admin_integration http://cmf.symfony.com/schema/dic/sonata_admin_integration/sonata_admin_integration.xsd"
233+
>
147234
148-
<config xmlns="http://sonata-project.org/schema/dic/admin">
149-
<!-- ... -->
150-
<extension id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_options">
151-
<implements>Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface</implements>
152-
</extension>
235+
<config xmlns="http://cmf.symfony.com/schema/dic/sonata_admin_integration">
236+
<bundles>
237+
<menu>
238+
<extensions>
239+
<menu-options
240+
enabled="true"
241+
advanced="false"
242+
form-group="form.group_menu_options"
243+
form-tab="form.tab_general"
244+
/>
245+
</extensions>
246+
</bundles>
153247
</config>
154248
</container>
155249
156250
.. code-block:: php
157251
158252
// app/config/config.php
159-
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface;
160-
161-
$container->loadFromExtension('sonata_admin', [
162-
'extensions' => [
163-
'cmf_sonata_phpcr_admin_integration.menu.extension.menu_options' => [
164-
'implements' => [
165-
MenuOptionsInterface::class,
253+
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
254+
'bundles' => [
255+
'menu' => [
256+
'extensions' => [
257+
'menu_options' => [
258+
'enabled' => true,
259+
'advanced' => false,
260+
'form_group' => 'form.group_menu_options',
261+
'form_tag' => 'form.tab_general',
262+
],
166263
],
167264
],
168265
],
169266
]);
170267
171-
See the `Sonata Admin extension documentation`_ for more information.
268+
``enabled``
269+
~~~~~~~~~~~
172270

173-
The extension makes these options editable (advanced options require additional
174-
setup, see below):
271+
**type**: ``bool`` **default**: ``true``
175272

176-
* Display;
177-
* Display children;
178-
* Menu attributes (advanced);
179-
* Label attributes (advanced);
180-
* Children attributes (advanced);
181-
* Link attributes (advanced).
273+
If ``false``, the extension is not loaded at all to save resources.
182274

183-
See the `KnpMenuBundle documentation`_ for more information about the meaning
184-
of those attributes.
275+
``form_group``
276+
~~~~~~~~~~~~~~
185277

186-
Advanced Menu Options
187-
~~~~~~~~~~~~~~~~~~~~~
278+
**type**: ``string`` **default**: ``form.group_menu_options``
279+
280+
.. include:: ../_partials/sonata_admin_form_group.rst.inc
281+
282+
``form_tab``
283+
~~~~~~~~~~~~
284+
285+
**type**: ``string`` **default**: ``form.tab_general``
286+
287+
.. include:: ../_partials/sonata_admin_form_tab.rst.inc
288+
289+
``advanced``
290+
~~~~~~~~~~~~
291+
292+
**type**: ``boolean`` **default**: ``false``
293+
294+
This activates advanced editing options for menu nodes. Without the extension,
295+
the only editable options are **Display** and **Display Children**.
188296

189-
By default the only available options are **Display** and **Display Children**.
190-
You can enable advanced options, but need to add the BurgovKeyValueFormBundle_
297+
To enable advanced options, you need to add the BurgovKeyValueFormBundle_
191298
to your project. Run ``composer require burgov/key-value-form-bundle``,
192299
instantiate the bundle in the kernel and extend the template
193300
``SonataAdminBundle:Form:form_admin_fields.html.twig`` to add:
@@ -201,17 +308,23 @@ instantiate the bundle in the kernel and extend the template
201308
Once you enabled the bundle, you can enable the advanced menu options in your
202309
configuration:
203310

311+
Using the extension
312+
~~~~~~~~~~~~~~~~~~~
313+
314+
To enable the extension in your admin classes, define the extension
315+
configuration in the ``sonata_admin`` section of your project configuration:
316+
204317
.. configuration-block::
205318

206319
.. code-block:: yaml
207320
208321
# app/config/config.yml
209-
cmf_sonata_phpcr_admin_integration:
210-
bundles:
211-
menu:
212-
extensions:
213-
menu_options:
214-
advanced: true
322+
sonata_admin:
323+
# ...
324+
extensions:
325+
cmf_sonata_phpcr_admin_integration.menu.extension.menu_options:
326+
implements:
327+
- Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface
215328
216329
.. code-block:: xml
217330
@@ -221,33 +334,44 @@ configuration:
221334
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
222335
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
223336
224-
<config xmlns="http://cmf.symfony.com/schema/dic/sonata-phpcr-admin-integration">
225-
<bundles>
226-
<menu>
227-
<extensions>
228-
<menu-options advanced="true">
229-
</extensions>
230-
</menu>
231-
</bundles>
337+
<config xmlns="http://sonata-project.org/schema/dic/admin">
338+
<!-- ... -->
339+
<extension id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_options">
340+
<implements>Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface</implements>
341+
</extension>
232342
</config>
233-
234343
</container>
235344
236345
.. code-block:: php
237346
238347
// app/config/config.php
239-
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
240-
'bundles' => [
241-
'menu' => [
242-
'extensions' => [
243-
'menu_options' => [
244-
'advanced' => true,
245-
],
348+
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface;
349+
350+
$container->loadFromExtension('sonata_admin', [
351+
'extensions' => [
352+
'cmf_sonata_phpcr_admin_integration.menu.extension.menu_options' => [
353+
'implements' => [
354+
MenuOptionsInterface::class,
246355
],
247356
],
248357
],
249358
]);
250359
360+
See the `Sonata Admin extension documentation`_ for more information.
361+
362+
The extension makes the following options editable (advanced options require additional
363+
setup, see above):
364+
365+
* Display;
366+
* Display children;
367+
* Menu attributes (advanced);
368+
* Label attributes (advanced);
369+
* Children attributes (advanced);
370+
* Link attributes (advanced).
371+
372+
See the `KnpMenuBundle documentation`_ for more information about the meaning
373+
of those attributes.
374+
251375
.. _`Sonata Admin extension documentation`: https://sonata-project.org/bundles/admin/master/doc/reference/extensions.html
252376
.. _SonataDoctrinePHPCRAdminBundle: https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/index.html
253377
.. _`the sonata admin documentation`: https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/configuration.html

0 commit comments

Comments
 (0)