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

Commit

Permalink
cleanup form_group and form_tab doc
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jun 17, 2017
1 parent e5f44ed commit bcf561a
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 76 deletions.
4 changes: 4 additions & 0 deletions bundles/_partials/sonata_admin_form_group.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The name of the form group to use in the admin extension.

The caption for the group is determined by translating the group name. If you
change the group, be sure to also define a translation for it.
4 changes: 4 additions & 0 deletions bundles/_partials/sonata_admin_form_tab.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The name of the form tab to use in the admin extension.

The caption for the tab is determined by translating the tab name. If you
change the tab name, be sure to also define a translation for it.
12 changes: 2 additions & 10 deletions bundles/sonata_phpcr_admin_integration/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,14 @@ admins as needed - see below for details.

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

Defines which form group the fields from this extension will appear in within
the Sonata Admin edit interface.

The caption for the group is determined by translating the group name. If you
change the group, be sure to also define a translation for it.
.. include:: ../_partials/sonata_admin_form_group.rst.inc

``form_tab``
~~~~~~~~~~~~

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

Defines which form tab the fields from this extension will appear in within
the Sonata Admin edit interface.

The caption for the tab is determined by translating the tab name. If you
change the tab name, be sure to also define a translation for it.
.. include:: ../_partials/sonata_admin_form_tab.rst.inc

Using Child Models: The Child Sonata Admin Extension
----------------------------------------------------
Expand Down
248 changes: 186 additions & 62 deletions bundles/sonata_phpcr_admin_integration/menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,89 @@ MenuNodeReferrersInterface Sonata Admin Extension
The menu admin integration provides an extension to edit referring menu nodes
for content that implements the ``MenuNodeReferrersInterface``.

To enable the extension in your admin classes, define the extension in the
The extension can be separately disabled and you can define the form group and
tab to be used by the field this extension adds:

.. configuration-block::

.. code-block:: yaml
# app/config/config.yml
cmf_sonata_phpcr_admin_integration:
bundles:
menu:
extensions:
menu_node_referrers:
enabled: true
form_group: form.group_menus
form_tab: form.tab_menu
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="2.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://cmf.symfony.com/schema/dic/sonata_admin_integration http://cmf.symfony.com/schema/dic/sonata_admin_integration/sonata_admin_integration.xsd"
>
<config xmlns="http://cmf.symfony.com/schema/dic/sonata_admin_integration">
<bundles>
<menu>
<extensions>
<menu-node-referrers
enabled="true"
form-group="form.group_menus"
form-tab="form.tab_menu"
/>
</extensions>
</bundles>
</config>
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
'bundles' => [
'menu' => [
'extensions' => [
'menu_node_referrers' => [
'enabled' => true,
'form_group' => 'form.group_menus',
'form_tag' => 'form.tab_menu',
],
],
],
],
]);
``enabled``
~~~~~~~~~~~

**type**: ``bool`` **default**: ``true``

If ``false``, the extension is not loaded at all to save resources.

``form_group``
~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``form.group_menus``

.. include:: ../_partials/sonata_admin_form_group.rst.inc

``form_tab``
~~~~~~~~~~~~

**type**: ``string`` **default**: ``form.tab_menu``

.. include:: ../_partials/sonata_admin_form_tab.rst.inc

Using the extension
~~~~~~~~~~~~~~~~~~~

To use the extension in your admin classes, define the extension in the
``sonata_admin`` section of your project configuration:

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

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

.. configuration-block::

.. code-block:: yaml
# app/config/config.yml
sonata_admin:
# ...
extensions:
cmf_sonata_phpcr_admin_integration.menu.extension.menu_options:
implements:
- Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface
cmf_sonata_phpcr_admin_integration:
bundles:
menu:
extensions:
menu_options:
enabled: true
advanced: false
form_group: form.group_menu_options
form_tab: form.tab_general
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://cmf.symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<?xml version="2.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://cmf.symfony.com/schema/dic/sonata_admin_integration http://cmf.symfony.com/schema/dic/sonata_admin_integration/sonata_admin_integration.xsd"
>
<config xmlns="http://sonata-project.org/schema/dic/admin">
<!-- ... -->
<extension id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_options">
<implements>Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface</implements>
</extension>
<config xmlns="http://cmf.symfony.com/schema/dic/sonata_admin_integration">
<bundles>
<menu>
<extensions>
<menu-options
enabled="true"
advanced="false"
form-group="form.group_menu_options"
form-tab="form.tab_general"
/>
</extensions>
</bundles>
</config>
</container>
.. code-block:: php
// app/config/config.php
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface;
$container->loadFromExtension('sonata_admin', [
'extensions' => [
'cmf_sonata_phpcr_admin_integration.menu.extension.menu_options' => [
'implements' => [
MenuOptionsInterface::class,
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
'bundles' => [
'menu' => [
'extensions' => [
'menu_options' => [
'enabled' => true,
'advanced' => false,
'form_group' => 'form.group_menu_options',
'form_tag' => 'form.tab_general',
],
],
],
],
]);
See the `Sonata Admin extension documentation`_ for more information.
``enabled``
~~~~~~~~~~~

The extension makes these options editable (advanced options require additional
setup, see below):
**type**: ``bool`` **default**: ``true``

* Display;
* Display children;
* Menu attributes (advanced);
* Label attributes (advanced);
* Children attributes (advanced);
* Link attributes (advanced).
If ``false``, the extension is not loaded at all to save resources.

See the `KnpMenuBundle documentation`_ for more information about the meaning
of those attributes.
``form_group``
~~~~~~~~~~~~~~

Advanced Menu Options
~~~~~~~~~~~~~~~~~~~~~
**type**: ``string`` **default**: ``form.group_menu_options``

.. include:: ../_partials/sonata_admin_form_group.rst.inc

``form_tab``
~~~~~~~~~~~~

**type**: ``string`` **default**: ``form.tab_general``

.. include:: ../_partials/sonata_admin_form_tab.rst.inc

``advanced``
~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``false``

This activates advanced editing options for menu nodes. Without the extension,
the only editable options are **Display** and **Display Children**.

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

Using the extension
~~~~~~~~~~~~~~~~~~~

To enable the extension in your admin classes, define the extension
configuration in the ``sonata_admin`` section of your project configuration:

.. configuration-block::

.. code-block:: yaml
# app/config/config.yml
cmf_sonata_phpcr_admin_integration:
bundles:
menu:
extensions:
menu_options:
advanced: true
sonata_admin:
# ...
extensions:
cmf_sonata_phpcr_admin_integration.menu.extension.menu_options:
implements:
- Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface
.. code-block:: xml
Expand All @@ -221,33 +334,44 @@ configuration:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<config xmlns="http://cmf.symfony.com/schema/dic/sonata-phpcr-admin-integration">
<bundles>
<menu>
<extensions>
<menu-options advanced="true">
</extensions>
</menu>
</bundles>
<config xmlns="http://sonata-project.org/schema/dic/admin">
<!-- ... -->
<extension id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_options">
<implements>Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface</implements>
</extension>
</config>
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
'bundles' => [
'menu' => [
'extensions' => [
'menu_options' => [
'advanced' => true,
],
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface;
$container->loadFromExtension('sonata_admin', [
'extensions' => [
'cmf_sonata_phpcr_admin_integration.menu.extension.menu_options' => [
'implements' => [
MenuOptionsInterface::class,
],
],
],
]);
See the `Sonata Admin extension documentation`_ for more information.

The extension makes the following options editable (advanced options require additional
setup, see above):

* Display;
* Display children;
* Menu attributes (advanced);
* Label attributes (advanced);
* Children attributes (advanced);
* Link attributes (advanced).

See the `KnpMenuBundle documentation`_ for more information about the meaning
of those attributes.

.. _`Sonata Admin extension documentation`: https://sonata-project.org/bundles/admin/master/doc/reference/extensions.html
.. _SonataDoctrinePHPCRAdminBundle: https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/index.html
.. _`the sonata admin documentation`: https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/configuration.html
Expand Down
Loading

0 comments on commit bcf561a

Please sign in to comment.