From 752f2ec04878a72d6ceb3aabe7768624e9bb0ff4 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 8 Mar 2017 08:30:19 +0100 Subject: [PATCH] update core bundle documentation for 2.0 --- book/database_layer.rst | 2 +- book/handling_multilang.rst | 7 +- bundles/core/configuration.rst | 134 +++-------- bundles/core/dependency_injection_tags.rst | 18 -- bundles/core/index.rst | 1 - bundles/core/introduction.rst | 16 +- bundles/core/persistence.rst | 123 +--------- bundles/core/publish_workflow.rst | 103 ++------ bundles/map.rst.inc | 1 - .../sonata_phpcr_admin_integration/core.rst | 225 ++++++++++++++++++ .../introduction.rst | 5 + 11 files changed, 290 insertions(+), 345 deletions(-) delete mode 100644 bundles/core/dependency_injection_tags.rst diff --git a/book/database_layer.rst b/book/database_layer.rst index f5b024f2..8469f30f 100644 --- a/book/database_layer.rst +++ b/book/database_layer.rst @@ -185,7 +185,7 @@ After this, you have to create getters and setters for the properties. You may want to implement ``Doctrine\ODM\PHPCR\HierarchyInterface`` which makes it for example possible to leverage the - :ref:`Sonata Admin Child Extension `. + :doc:`Sonata Admin Child Extension <../bundles/sonata_phpcr_admin_integration/core>`. .. seealso:: diff --git a/book/handling_multilang.rst b/book/handling_multilang.rst index ccee221e..8d6c8dd3 100644 --- a/book/handling_multilang.rst +++ b/book/handling_multilang.rst @@ -320,10 +320,8 @@ default locale, for example ``/de/admin/dashboard``. When clicking on the language switcher, the page reloads and displays the correct content for the requested language. -If your documents implement the TranslatableInterface, you can -:ref:`configure the translatable admin extension ` -to get a language choice field to let the administrator -choose in which language to store the content. +If your documents implement the TranslatableInterface, use the +SonataTranslationBundle_ to enable multi-language editing in the admin backend. Frontend Editing and multi-language ----------------------------------- @@ -348,3 +346,4 @@ save the edited document in the same language as it was loaded. .. _`cmf-sandbox config.yml file`: https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml .. _`PHPCR-ODM documentation on multi-language`: http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/reference/multilang.html .. _`issue`: https://github.com/symfony-cmf/create-bundle/issues/39 +.. _SonataTranslationBundle: https://packagist.org/packages/sonata-project/translation-bundle diff --git a/bundles/core/configuration.rst b/bundles/core/configuration.rst index e1d00fa1..89ef7099 100644 --- a/bundles/core/configuration.rst +++ b/bundles/core/configuration.rst @@ -8,6 +8,10 @@ configuration. When using XML, you can use the Configuration ------------- +Some configuration settings set on the CoreBundle are forwarded as default +configuration to all CMF bundles that are installed in your application. This +is explicitly listed below for each configuration option that is forwarded. + .. _config-core-persistence: ``persistence`` @@ -16,8 +20,8 @@ Configuration ``phpcr`` ......... -This defines the persistence driver. The default configuration of persistence -is the following configuration: +This enables the persistence driver for the PHP content repository. The default +configuration is the following: .. configuration-block:: @@ -31,7 +35,6 @@ is the following configuration: basepath: /cms manager_registry: doctrine_phpcr manager_name: ~ - use_sonata_admin: auto translation_strategy: ~ .. code-block:: xml @@ -47,7 +50,6 @@ is the following configuration: basepath="/cms" manager-registery="doctrine_phpcr" manager-name="null" - use-sonata-admin="auto" translation-strategy="null" /> @@ -65,7 +67,6 @@ is the following configuration: 'basepath' => '/cms/simple', 'manager_registry' => 'doctrine_phpcr', 'manager_name' => null, - 'use_sonata_admin' => 'auto', 'translation_strategy' => null, ], ], @@ -74,8 +75,8 @@ is the following configuration: ``orm`` ....... -This defines the persistence driver. The default configuration of persistence -is the following configuration: +This enables the persistence driver for relational databases. The default +configuration is the following: .. configuration-block:: @@ -87,7 +88,6 @@ is the following configuration: orm: enabled: false manager_name: ~ - use_sonata_admin: auto .. code-block:: xml @@ -100,7 +100,6 @@ is the following configuration: @@ -115,7 +114,6 @@ is the following configuration: 'phpcr' => [ 'enabled' => false, 'manager_name' => null, - 'use_sonata_admin' => 'auto', ], ], ]); @@ -125,7 +123,8 @@ is the following configuration: .. include:: ../_partials/persistence_phpcr_enabled.rst.inc -Enabling this setting will also automatically enable the equivalent setting in the following Bundles: +This setting is propagated as default value to all installed CMF bundles that support +this setting: * :doc:`BlockBundle <../block/introduction>` * :doc:`ContentBundle <../content/introduction>` @@ -135,7 +134,6 @@ Enabling this setting will also automatically enable the equivalent setting in t * :doc:`RoutingBundle <../routing/introduction>` * :doc:`SearchBundle <../search/introduction>` * :doc:`SimpleCmsBundle <../simple_cms/introduction>` -* :doc:`TreeBrowserCmsBundle <../tree_browser/introduction>` ``basepath`` """""""""""" @@ -144,7 +142,8 @@ Enabling this setting will also automatically enable the equivalent setting in t The basepath for CMS documents in the PHPCR tree. -Enabling this setting will also automatically enable the equivalent settings in the following Bundles: +This setting is propagated as default value to all installed CMF bundles that support +this setting: * :doc:`BlockBundle <../block/introduction>` * :doc:`ContentBundle <../content/introduction>` @@ -152,6 +151,7 @@ Enabling this setting will also automatically enable the equivalent settings in * :doc:`MenuBundle <../menu/introduction>` * :doc:`RoutingBundle <../routing/introduction>` * :doc:`SearchBundle <../search/introduction>` +* :doc:`SeoBundle <../seo/introduction>` * :doc:`SimpleCmsBundle <../simple_cms/introduction>` ``manager_registry`` @@ -159,7 +159,11 @@ Enabling this setting will also automatically enable the equivalent settings in **type**: ``string`` **default**: ``doctrine_phpcr`` -Enabling this setting will also automatically enable the equivalent settings in the following Bundles: +The doctrine registry from which to get the document manager. This setting +only needs to be changed when configuring multiple manager registries. + +This setting is propagated as default value to all installed CMF bundles that support +this setting: * :doc:`SearchBundle <../search/introduction>` * :doc:`SimpleCmsBundle <../simple_cms/introduction>` @@ -170,9 +174,10 @@ Enabling this setting will also automatically enable the equivalent settings in **type**: ``string`` **default**: ``null`` The name of the Doctrine Manager to use. ``null`` tells the manager registry to -retrieve the default manager. +retrieve the default manager. -Enabling this setting will also automatically enable the equivalent setting in the following Bundles: +This setting is propagated as default value to all installed CMF bundles that support +this setting: * :doc:`BlockBundle <../block/introduction>` * :doc:`MediaBundle <../media/introduction>` @@ -181,44 +186,27 @@ Enabling this setting will also automatically enable the equivalent setting in t * :doc:`SearchBundle <../search/introduction>` * :doc:`SimpleCmsBundle <../simple_cms/introduction>` -``use_sonata_admin`` -"""""""""""""""""""" - -**type**: ``enum`` **valid values**: ``true|false|auto`` **default**: ``auto`` - -If ``true``, the admin classes for SimpleCmsBundle pages are activated. If set -to ``auto``, the admin services are activated only if the -SonataPhpcrAdminBundle is present. - -Enabling this setting will also automatically enable the equivalent setting in the following Bundles: - -* :doc:`BlockBundle <../block/introduction>` -* :doc:`ContentBundle <../content/introduction>` -* :doc:`MenuBundle <../menu/introduction>` -* :doc:`RoutingBundle <../routing/introduction>` -* :doc:`SimpleCmsBundle <../simple_cms/introduction>` - ``translation_strategy`` """""""""""""""""""""""" **type**: ``string`` **default**: ``null`` -This setting can be used to force a specific translation strategy for all documents. +This setting can be used to :ref:`force a specific translation strategy ` +for all documents. .. _config-core-multilang: ``multilang`` ~~~~~~~~~~~~~ -This configures whether multiple languages mode should be activated. +This configures the locales to use in multiple languages mode. If the ``multilang`` option is *not* defined at all, the CoreBundle registers a listener for Doctrine PHPCR-ODM that modifies PHPCR-ODM metadata to remove the translatable attribute from all fields. -If multi-language is enabled, the ``TranslatableExtension`` for -``SonataAdminBundle`` is enabled and the locales will be configured on all CMF -bundles that use this configuration: +If multi-language is enabled, the locales will be configured as default on all +installed CMF bundles that use this configuration: * :doc:`RoutingBundle <../routing/introduction>` * :doc:`SimpleCmsBundle <../simple_cms/introduction>` @@ -263,7 +251,7 @@ bundles that use this configuration: **type**: ``array`` **default**: ``null`` -This define languages that can be used. +List of the languages that can be used with the storage. ``publish_workflow`` ~~~~~~~~~~~~~~~~~~~~ @@ -311,71 +299,3 @@ only published routes and content can be accessed. 'request_listener' => true, ], ]); - -Sonata Admin ------------- - -This section configures the Sonata Admin Extensions, see: - -* :ref:`Publish Workflow Admin Extensions `; -* :ref:`Translatable Admin Extension `. -* :ref:`Child Admin Extension `. - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - cmf_core: - sonata_admin: - extensions: - publishable: - form_group: form.group_publish_workflow - publish_time: - form_group: form.group_general - translatable: - form_group: form.group_general - - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php - - // app/config/config.php - $container->loadFromExtension('cmf_core', [ - 'sonata_admin' => [ - 'extensions' => [ - 'publishable' => [ - 'form_group' => 'form.group_publish_workflow', - ], - 'publish_time' => [ - 'form_group' => 'form.group_general', - ], - 'translatable' => [ - 'form_group' => 'form.group_general', - ], - ], - ], - ]); - -``form_group`` -~~~~~~~~~~~~~~ - -**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. diff --git a/bundles/core/dependency_injection_tags.rst b/bundles/core/dependency_injection_tags.rst deleted file mode 100644 index bdca6969..00000000 --- a/bundles/core/dependency_injection_tags.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. index:: - single: Dependency Injection Tags; CoreBundle - -Dependency Injection Tags -------------------------- - -cmf_published_voter -~~~~~~~~~~~~~~~~~~~ - -Used to activate :ref:`custom voters ` for the -:doc:`publish workflow `. Tagging a service with -``cmf_published_voter`` integrates it into the access decision of the publish -workflow. - -This tag has the attribute ``priority``. The lower the priority number, the -earlier the voter gets to vote. - -.. _`synchronized service`: https://symfony.com/doc/current/cookbook/service_container/scopes.html#a-using-a-synchronized-service diff --git a/bundles/core/index.rst b/bundles/core/index.rst index 317698fa..f1a80820 100644 --- a/bundles/core/index.rst +++ b/bundles/core/index.rst @@ -6,7 +6,6 @@ CoreBundle introduction publish_workflow - dependency_injection_tags templating persistence forms diff --git a/bundles/core/introduction.rst b/bundles/core/introduction.rst index 2e027082..7ef1c33a 100644 --- a/bundles/core/introduction.rst +++ b/bundles/core/introduction.rst @@ -7,15 +7,13 @@ CoreBundle This bundle provides common functionality, helpers and utilities for the other CMF bundles. -One of the provided features is an interface and implementation of a publish -workflow checker with an accompanying interface that models can implement if -they want to support this checker. +The major features are: -Furthermore, it provides a Twig helper exposing several useful functions for -Twig templates to interact with PHPCR-ODM documents. - -Finally, most of its configuration settings are automatically applied as -defaults for most of the other CMF Bundles. +* Publish workflow interfaces and publish workflow checker to handle whether + documents should be visible on the site or not; +* Twig helper exposing several useful functions to interact with PHPCR-ODM + documents from within Twig templates; +* Propagate default configuration to the other CMF bundles. Installation ------------ @@ -27,8 +25,8 @@ Sections -------- * :doc:`publish_workflow` -* :doc:`dependency_injection_tags` * :doc:`templating` +* :doc:`forms` * :doc:`persistence` * :doc:`configuration` diff --git a/bundles/core/persistence.rst b/bundles/core/persistence.rst index 55271287..068aebf5 100644 --- a/bundles/core/persistence.rst +++ b/bundles/core/persistence.rst @@ -52,6 +52,8 @@ Persisting Documents in Different Languages Refer to the `PHPCR-ODM documentation`_ for details on persisting documents in different languages. +.. _bundles-core-multilang-global_translation_strategy: + Choosing a Global Translation Strategy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -107,125 +109,4 @@ enforce a single translation strategy for all documents: See the `PHPCR-ODM documentation`_ for more information. -.. _bundle-core-child-admin-extension: - -Using Child Models: The Child Sonata Admin Extension -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This extension sets a default parent to every new -object instance if a ``parent`` parameter is present in the URL. -The parent parameter is present for example when adding documents -in an overlay with the ``doctrine_phpcr_odm_tree_manager`` -or when adding a document in the tree of the dashboard. - -.. note:: - - This extension is only available if ``cmf_core.persistence.phpcr`` is enabled - and SonataPHPCRAdminBundle is active. - -To enable the extension in your admin classes, simply define the extension -configuration in the ``sonata_admin`` section of your project configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - sonata_admin: - # ... - extensions: - cmf_core.admin_extension.child: - implements: - - Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface - - Doctrine\ODM\PHPCR\HierarchyInterface - - .. code-block:: xml - - - - - - - - Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface - Doctrine\ODM\PHPCR\HierarchyInterface - - - - - - .. code-block:: php - - // app/config/config.php - $container->loadFromExtension('sonata_admin', [ - // ... - 'extensions' => [ - 'cmf_core.admin_extension.child' => [ - 'implements' => [ - 'Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface', - 'Doctrine\ODM\PHPCR\HierarchyInterface', - ], - ], - ], - ]); - -See the `Sonata Admin extension documentation`_ for more information. - -.. _bundle-core-translatable-admin-extension: - -Editing Locale Information: Translatable Sonata Admin Extension -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Several bundles provide translatable model classes that implement -``TranslatableInterface``. This extension adds a locale field -to the given SonataAdminBundle forms. - -To enable the extensions in your admin classes, simply define the extension -configuration in the ``sonata_admin`` section of your project configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - sonata_admin: - # ... - extensions: - cmf_core.admin_extension.translatable: - implements: - - Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface - - .. code-block:: xml - - - - - - - - - Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface - - - - - - - .. code-block:: php - - // app/config/config.php - $container->loadFromExtension('sonata_admin', [ - // ... - 'extensions' => [ - 'cmf_core.admin_extension.translatable' => [ - 'implements' => [ - 'Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface', - ], - ], - ], - ]); - -See the `Sonata Admin extension documentation`_ for more information. - -.. _`Sonata Admin extension documentation`: https://sonata-project.org/bundles/admin/master/doc/reference/extensions.html .. _`PHPCR-ODM documentation`: http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/reference/multilang.html#full-example diff --git a/bundles/core/publish_workflow.rst b/bundles/core/publish_workflow.rst index a65984ca..fc83d677 100644 --- a/bundles/core/publish_workflow.rst +++ b/bundles/core/publish_workflow.rst @@ -20,7 +20,6 @@ publication. A good introduction to the Symfony core security can be found in the `Security Chapter`_ of the Symfony2 book. - The default publish workflow corresponds to the following diagram: .. image:: ../../_images/bundles/core_pwf_workflow.png @@ -46,8 +45,9 @@ Currently the only actions supported by the default voters are ``VIEW`` and ``VIEW_ANONYMOUS``. Having the right to view means that the current user is allowed to see this content either because it is published or because of their specific permissions. In some contexts, your application might not want to -show unpublished content even to a privileged user so as not to confuse them. -For this, the "view anonymous" permission is used. +show unpublished content even to privileged users so as not to confuse them. +For this, the "view anonymous" permission is used to check if a content is +published. The workflow checker is configured with a role that is allowed to bypass publication checks so that it can see unpublished content. This role should be @@ -84,8 +84,9 @@ given to editors. The default name of the role is ``ROLE_CAN_VIEW_NON_PUBLISHED` ], ]); -Once a user with ``ROLE_EDITOR`` is logged in - meaning there is a firewall in place for -the path in question - they will have the permission to view unpublished content as well:: +Once a user with ``ROLE_CAN_VIEW_NON_PUBLISHED`` is logged in - meaning there +is a firewall in place for the path in question - they will have the permission +to view unpublished content as well:: use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker; @@ -112,8 +113,8 @@ the path in question - they will have the permission to view unpublished content .. _bundle-core-publish-workflow-twig_function: -To check publication in a template, use the Twig function ``cmf_is_published`` -or the ``$view['cmf']->isPublished`` method: +To check publication in a template, use the Twig function ``cmf_is_published``, +in PHP templating the ``$view['cmf']->isPublished`` method: .. configuration-block:: @@ -157,10 +158,9 @@ or the ``$view['cmf']->isPublished`` method: Code that loads content should do the publish checks. Thanks to a :ref:`request listener `, routes and the main content provided by the -:doc:`DynamicRouter <../routing/dynamic>` are checked automatically -as well. +:doc:`DynamicRouter <../routing/dynamic>` are checked automatically already. -It is possible to set the security token explicitly on the workflow checker. +It is possible to explicitly set the security token on the workflow checker. But by default, the checker will acquire the token from the default security context, and if there is none (typically when there is no firewall in place for that URL), an @@ -362,84 +362,21 @@ This means that custom templates for ``templates_by_class`` and the controllers of ``controllers_by_class`` need not check for publication explicitly as its already done. -.. _bundle-core-workflow-admin-extensions: - -Editing publication information: Publish Workflow Sonata Admin Extension -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Editing Publish Workflow Information +------------------------------------ There is a write interface for each publish workflow too, defining setter -methods. The core bundle provides extensions for SonataAdminBundle to easily -add editing of the publish workflow fields to all or selected admins. - -Instead of implementing ``PublishableReadInterface`` resp. -``PublishTimePeriodReadInterface`` you models instead need to implement the -``PublishableInterface`` and / or ``PublishTimePeriodInterface``. - -To enable the extensions in your admin classes, simply define the extension -configuration in the ``sonata_admin`` section of your project configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - sonata_admin: - # ... - extensions: - cmf_core.admin_extension.publish_workflow.publishable: - implements: - - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface - cmf_core.admin_extension.publish_workflow.time_period: - implements: - - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface - - .. code-block:: xml - - - - - - - - - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface - - - - - - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface - - - - - - .. code-block:: php - - // app/config/config.php - use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface; - use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface; - - $container->loadFromExtension('sonata_admin', [ - // ... - 'extensions' => [ - 'cmf_core.admin_extension.publish_workflow.publishable' => [ - 'implements' => [ - PublishableInterface::class, - ], - ], - 'cmf_core.admin_extension.publish_workflow.time_period' => [ - 'implements' => [ - PublishTimePeriodInterface::class, - ], - ], - ], - ]); +methods. You can implement the write interfaces in your models to make +publication information editable. Instead of implementing +``PublishableReadInterface`` resp. ``PublishTimePeriodReadInterface``, +implement the interfaces ``PublishableInterface`` and / or +``PublishTimePeriodInterface`` in your models. -See the `Sonata Admin extension documentation`_ for more information. +There is a :doc:`Sonata admin extension <../sonata_phpcr_admin_integration/core>` +available to edit workflow information on any document implementing the +interface. .. _`Symfony2 security component`: https://symfony.com/doc/current/components/security/index.html .. _`Symfony2 Authorization`: https://symfony.com/doc/current/components/security/authorization.html .. _`Security Chapter`: https://symfony.com/doc/current/book/security.html .. _`ACL checks`: https://symfony.com/doc/current/cookbook/security/acl.html -.. _`Sonata Admin extension documentation`: https://sonata-project.org/bundles/admin/master/doc/reference/extensions.html diff --git a/bundles/map.rst.inc b/bundles/map.rst.inc index 64c21e45..8ab19a8a 100644 --- a/bundles/map.rst.inc +++ b/bundles/map.rst.inc @@ -17,7 +17,6 @@ library or they introduce a complete new concept. * :doc:`core/introduction` * :doc:`core/publish_workflow` - * :doc:`core/dependency_injection_tags` * :doc:`core/templating` * :doc:`core/persistence` * :doc:`core/forms` diff --git a/bundles/sonata_phpcr_admin_integration/core.rst b/bundles/sonata_phpcr_admin_integration/core.rst index 14f5e0d1..a529b2f1 100644 --- a/bundles/sonata_phpcr_admin_integration/core.rst +++ b/bundles/sonata_phpcr_admin_integration/core.rst @@ -1,2 +1,227 @@ CoreBundle ========== + +The CoreBundle has no own documents that can be edited, but we provide admin +extensions under the core bundle namespace that are useful for all documents. + +Admin extensions can be added to admin services through configuration in the +SonataAdminBundle. See the `Sonata Admin extension documentation`_ for more +information. + +We provide the child extension to help with adding documents in overlay dialogs, +and extensions to edit publish workflow information. + +Configuration +------------- + +This section configures the admin extensions for publish workflow editing. + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + cmf_sonata_phpcr_admin_integration: + bundles: + core: + extensions: + publishable: + form_group: form.group_publish_workflow + form_tab: form.tab_publish + publish_time: + form_group: form.group_publish_workflow + form_tab: form.tab_publish + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [ + 'bundles' => [ + 'core' => [ + 'extensions' => [ + 'publishable' => [ + 'form_group' => 'form.group_publish_workflow', + 'form_tab' => 'form.tab_publish', + ], + 'publish_time' => [ + 'form_group' => 'form.group_publish_workflow', + 'form_tab' => 'form.tab_publish', + ], + ], + ], + ], + ]); + +Note that the child extension has no configuration and just can be attached to +admins as needed - see below for details. + +``form_group`` +~~~~~~~~~~~~~~ + +**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. + +``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. + +Using Child Models: The Child Sonata Admin Extension +---------------------------------------------------- + +This extension sets a default parent to every new object instance if a +``parent`` parameter is present in the URL. The parent parameter is present +for example when adding documents in an overlay with the +``doctrine_phpcr_odm_tree_manager`` or when adding a document in the tree of +the dashboard. + +To enable the extension in your admin classes, simply define the extension +configuration in the ``sonata_admin`` section of your project configuration: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + sonata_admin: + # ... + extensions: + cmf_sonata_phpcr_admin_integration.core.extension.child: + implements: + - Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface + - Doctrine\ODM\PHPCR\HierarchyInterface + + .. code-block:: xml + + + + + + + + Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface + Doctrine\ODM\PHPCR\HierarchyInterface + + + + + + .. code-block:: php + + // app/config/config.php + use Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface; + use Doctrine\ODM\PHPCR\HierarchyInterface; + + $container->loadFromExtension('sonata_admin', [ + // ... + 'extensions' => [ + 'cmf_sonata_phpcr_admin_integration.core.extension.child' => [ + 'implements' => [ + ChildInterface::class, + HierarchyInterface::class, + ], + ], + ], + ]); + +Editing publication information: Publish Workflow Sonata Admin Extension +------------------------------------------------------------------------ + +When using the :doc:`write interface of the publish workflow <../core/publish_workflow>`, +this admin extension can be used to edit publication information. + +To enable the extensions 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 + sonata_admin: + # ... + extensions: + cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable: + implements: + - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface + cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period: + implements: + - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface + + .. code-block:: xml + + + + + + + + + Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface + + + + + + Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface + + + + + + .. code-block:: php + + // app/config/config.php + use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface; + use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface; + + $container->loadFromExtension('sonata_admin', [ + // ... + 'extensions' => [ + 'cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable' => [ + 'implements' => [ + PublishableInterface::class, + ], + ], + 'cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period' => [ + 'implements' => [ + PublishTimePeriodInterface::class, + ], + ], + ], + ]); + +.. _`Sonata Admin extension documentation`: https://sonata-project.org/bundles/admin/master/doc/reference/extensions.html diff --git a/bundles/sonata_phpcr_admin_integration/introduction.rst b/bundles/sonata_phpcr_admin_integration/introduction.rst index b1c7dc77..87f18903 100644 --- a/bundles/sonata_phpcr_admin_integration/introduction.rst +++ b/bundles/sonata_phpcr_admin_integration/introduction.rst @@ -9,6 +9,11 @@ SonataPhpcrAdminIntegrationBundle Admin tool. Additionally, it provides admin extensions to improve your custom admin services. +.. note:: + + The admin integration bundle is not yet released as stable. It is still + possible that there will be minor BC breaks until it is released. + Installation ------------