From bcf561af0ea9deb8ea9859e24e7ab890cb90bcc8 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 17 Jun 2017 14:36:17 +0200 Subject: [PATCH] cleanup form_group and form_tab doc --- .../_partials/sonata_admin_form_group.rst.inc | 4 + .../_partials/sonata_admin_form_tab.rst.inc | 4 + .../sonata_phpcr_admin_integration/core.rst | 12 +- .../sonata_phpcr_admin_integration/menu.rst | 248 +++++++++++++----- .../routing.rst | 70 +++++ .../sonata_phpcr_admin_integration/seo.rst | 8 +- 6 files changed, 270 insertions(+), 76 deletions(-) create mode 100644 bundles/_partials/sonata_admin_form_group.rst.inc create mode 100644 bundles/_partials/sonata_admin_form_tab.rst.inc diff --git a/bundles/_partials/sonata_admin_form_group.rst.inc b/bundles/_partials/sonata_admin_form_group.rst.inc new file mode 100644 index 00000000..1a38f3db --- /dev/null +++ b/bundles/_partials/sonata_admin_form_group.rst.inc @@ -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. diff --git a/bundles/_partials/sonata_admin_form_tab.rst.inc b/bundles/_partials/sonata_admin_form_tab.rst.inc new file mode 100644 index 00000000..8d113407 --- /dev/null +++ b/bundles/_partials/sonata_admin_form_tab.rst.inc @@ -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. diff --git a/bundles/sonata_phpcr_admin_integration/core.rst b/bundles/sonata_phpcr_admin_integration/core.rst index 4495e9fb..5e2815ef 100644 --- a/bundles/sonata_phpcr_admin_integration/core.rst +++ b/bundles/sonata_phpcr_admin_integration/core.rst @@ -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 ---------------------------------------------------- diff --git a/bundles/sonata_phpcr_admin_integration/menu.rst b/bundles/sonata_phpcr_admin_integration/menu.rst index 7f8090f9..8fda0b85 100644 --- a/bundles/sonata_phpcr_admin_integration/menu.rst +++ b/bundles/sonata_phpcr_admin_integration/menu.rst @@ -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 + + + + + + + + + + + + + + + + .. 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:: @@ -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 - - + + - - - - Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface - + + + + + + + .. 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: @@ -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 @@ -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"> - - - - - - - - + + + + Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface + - .. 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 diff --git a/bundles/sonata_phpcr_admin_integration/routing.rst b/bundles/sonata_phpcr_admin_integration/routing.rst index 08d65ec6..26e51583 100644 --- a/bundles/sonata_phpcr_admin_integration/routing.rst +++ b/bundles/sonata_phpcr_admin_integration/routing.rst @@ -91,6 +91,76 @@ RouteReferrersInterface Admin Extension This bundle provides an extension to edit referring routes for content that implements the ``RouteReferrersInterface``. + +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: + routing: + extensions: + referrers: + form_group: form.group_routing + form_tab: form.tab_routing + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [ + 'bundles' => [ + 'routing' => [ + 'extensions' => [ + 'referrers' => [ + 'form_group' => 'form.group_routing', + 'form_tag' => 'form.tab_routing', + ], + ], + ], + ], + ]); + +``form_group`` +************** + +**type**: ``string`` **default**: ``form.group_routing`` + +.. include:: ../_partials/sonata_admin_form_group.rst.inc + +``form_tab`` +************ + +**type**: ``string`` **default**: ``form.tab_routing`` + +.. include:: ../_partials/sonata_admin_form_tab.rst.inc + To enable the extensions in your admin classes, define the extension configuration in the ``sonata_admin`` section of your project configuration: diff --git a/bundles/sonata_phpcr_admin_integration/seo.rst b/bundles/sonata_phpcr_admin_integration/seo.rst index fc3f4531..37d19350 100644 --- a/bundles/sonata_phpcr_admin_integration/seo.rst +++ b/bundles/sonata_phpcr_admin_integration/seo.rst @@ -69,18 +69,18 @@ This section configures the admin extension for SEO aware content. .. include:: ../_partials/sonata_admin_enabled.rst.inc ``form_group`` -"""""""""""""" +~~~~~~~~~~~~~~ **type**: ``string`` **default**: ``form.group_seo`` -The name of the form group to use in the admin extension. +.. include:: ../_partials/sonata_admin_form_group.rst.inc ``form_tab`` -"""""""""""" +~~~~~~~~~~~~ **type**: ``string`` **default**: ``form.tab_seo`` -The name of the form tab to use in the admin extension. +.. include:: ../_partials/sonata_admin_form_tab.rst.inc SeoAwareInterface Admin Extension ---------------------------------