diff --git a/bundles/core/configuration.rst b/bundles/core/configuration.rst index 7466a093..e1d00fa1 100644 --- a/bundles/core/configuration.rst +++ b/bundles/core/configuration.rst @@ -23,6 +23,7 @@ is the following configuration: .. code-block:: yaml + # app/config/config.yml cmf_core: persistence: phpcr: @@ -35,6 +36,7 @@ is the following configuration: .. code-block:: xml + @@ -55,18 +57,19 @@ is the following configuration: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'persistence' => array( - 'phpcr' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'persistence' => [ + 'phpcr' => [ 'enabled' => false, 'basepath' => '/cms/simple', 'manager_registry' => 'doctrine_phpcr', 'manager_name' => null, 'use_sonata_admin' => 'auto', 'translation_strategy' => null, - ), - ), - )); + ], + ], + ]); ``orm`` ....... @@ -78,6 +81,7 @@ is the following configuration: .. code-block:: yaml + # app/config/config.yml cmf_core: persistence: orm: @@ -87,6 +91,7 @@ is the following configuration: .. code-block:: xml + @@ -104,15 +109,16 @@ is the following configuration: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'persistence' => array( - 'phpcr' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'persistence' => [ + 'phpcr' => [ 'enabled' => false, 'manager_name' => null, 'use_sonata_admin' => 'auto', - ), - ), - )); + ], + ], + ]); ``enabled`` """"""""""" @@ -221,12 +227,14 @@ bundles that use this configuration: .. code-block:: yaml + # app/config/config.yml cmf_core: multilang: locales: [en, fr] .. code-block:: xml + @@ -240,14 +248,15 @@ bundles that use this configuration: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'multilang' => array( - 'locales' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'multilang' => [ + 'locales' => [ 'en', 'fr', - ), - ), - )); + ], + ], + ]); ``locales`` ........... @@ -267,6 +276,7 @@ only published routes and content can be accessed. .. code-block:: yaml + # app/config/config.yml cmf_core: publish_workflow: enabled: true @@ -276,6 +286,7 @@ only published routes and content can be accessed. .. code-block:: xml + @@ -291,14 +302,15 @@ only published routes and content can be accessed. .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'publish_workflow' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'publish_workflow' => [ 'enabled' => true, 'checker_service' => 'cmf_core.publish_workflow.checker.default', 'view_non_published_role' => 'ROLE_CAN_VIEW_NON_PUBLISHED', 'request_listener' => true, - ), - )); + ], + ]); Sonata Admin ------------ @@ -313,6 +325,7 @@ This section configures the Sonata Admin Extensions, see: .. code-block:: yaml + # app/config/config.yml cmf_core: sonata_admin: extensions: @@ -325,6 +338,7 @@ This section configures the Sonata Admin Extensions, see: .. code-block:: xml + @@ -341,21 +355,22 @@ This section configures the Sonata Admin Extensions, see: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'sonata_admin' => array( - 'extensions' => array( - 'publishable' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'sonata_admin' => [ + 'extensions' => [ + 'publishable' => [ 'form_group' => 'form.group_publish_workflow', - ), - 'publish_time' => array( + ], + 'publish_time' => [ 'form_group' => 'form.group_general', - ), - 'translatable' => array( + ], + 'translatable' => [ 'form_group' => 'form.group_general', - ), - ), - ), - )); + ], + ], + ], + ]); ``form_group`` ~~~~~~~~~~~~~~ diff --git a/bundles/core/forms.rst b/bundles/core/forms.rst index 72d918ac..16583ff3 100644 --- a/bundles/core/forms.rst +++ b/bundles/core/forms.rst @@ -14,13 +14,13 @@ typically a "terms and conditions" document. When using this type, you additionally specify ``content_ids``, which are understood by the :doc:`DynamicRouter <../routing/dynamic>`, along with replacement tokens:: - $form->add('terms', 'cmf_core_checkbox_url_label', array( + $form->add('terms', 'cmf_core_checkbox_url_label', [ 'label' => 'I have seen the Team and More pages ...', - 'content_ids' => array( + 'content_ids' => [ '%team%' => '/cms/content/static/team', '%more%' => '/cms/content/static/more', - ), - )); + ], + ]); The form type automatically generates the routes for the specified content and passes the routes to the ``trans`` Twig helper for replacement in the label. diff --git a/bundles/core/persistence.rst b/bundles/core/persistence.rst index 9532df30..55271287 100644 --- a/bundles/core/persistence.rst +++ b/bundles/core/persistence.rst @@ -16,12 +16,15 @@ the following to your main configuration file: .. code-block:: yaml - cmf_core: - persistence: - phpcr: ~ + # app/config/config.yml + services: + cmf_core: + persistence: + phpcr: ~ .. code-block:: xml + @@ -35,11 +38,12 @@ the following to your main configuration file: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'persistence' => array( - 'phpcr' => array(), - ), - )); + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'persistence' => [ + 'phpcr' => [], + ], + ]); .. _bundles-core-multilang-persisting_multilang_documents: @@ -64,6 +68,7 @@ enforce a single translation strategy for all documents: .. code-block:: yaml + # app/config/config.yml cmf_core: persistence: phpcr: @@ -71,14 +76,13 @@ enforce a single translation strategy for all documents: .. code-block:: xml + - + @@ -86,13 +90,14 @@ enforce a single translation strategy for all documents: .. code-block:: php - $container->loadFromExtension('cmf_core', array( - 'persistence' => array( - 'phpcr' => array( + // app/config/config.php + $container->loadFromExtension('cmf_core', [ + 'persistence' => [ + 'phpcr' => [ 'translation_strategy' => 'attribute', - ), - ), - )); + ], + ], + ]); .. caution:: @@ -152,17 +157,17 @@ configuration in the ``sonata_admin`` section of your project configuration: .. code-block:: php // app/config/config.php - $container->loadFromExtension('sonata_admin', array( + $container->loadFromExtension('sonata_admin', [ // ... - 'extensions' => array( - 'cmf_core.admin_extension.child' => array( - 'implements' => array( + '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. @@ -209,16 +214,16 @@ configuration in the ``sonata_admin`` section of your project configuration: .. code-block:: php // app/config/config.php - $container->loadFromExtension('sonata_admin', array( + $container->loadFromExtension('sonata_admin', [ // ... - 'extensions' => array( - 'cmf_core.admin_extension.translatable' => array( - 'implements' => array( + 'extensions' => [ + 'cmf_core.admin_extension.translatable' => [ + 'implements' => [ 'Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface', - ), - ), - ), - )); + ], + ], + ], + ]); See the `Sonata Admin extension documentation`_ for more information. diff --git a/bundles/core/publish_workflow.rst b/bundles/core/publish_workflow.rst index 3ca36e04..a65984ca 100644 --- a/bundles/core/publish_workflow.rst +++ b/bundles/core/publish_workflow.rst @@ -78,11 +78,11 @@ given to editors. The default name of the role is ``ROLE_CAN_VIEW_NON_PUBLISHED` .. code-block:: php // app/config/security.php - $container->loadFromExtension('security', array( - 'role_hierarchy' => array( + $container->loadFromExtension('security', [ + 'role_hierarchy' => [ 'ROLE_EDITOR' => '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:: @@ -304,17 +304,19 @@ you can lower the priority of those voters: .. code-block:: yaml + # app/config/services.yml services: - security.publishable_voter: + app.publishable_voter: class: "AppBundle\Security\PublishableVoter" tags: - { name: cmf_published_voter, priority: 30 } .. code-block:: xml + - @@ -323,14 +325,16 @@ you can lower the priority of those voters: .. code-block:: php + // app/config/config.php use Symfony\Component\DependencyInjection\Definition; + use AppBundle\Security\PublishableVoter; $container ->register( - 'security.publishable_voter', - 'AppBundle\Security\PublishableVoter' + 'app.publishable_voter', + PublishableVoter::class ) - ->addTag('cmf_published_voter', array('priority' => 30)) + ->addTag('cmf_published_voter', ['priority' => 30]) ; The workflow checker will create an @@ -413,21 +417,24 @@ configuration in the ``sonata_admin`` section of your project configuration: .. code-block:: php // app/config/config.php - $container->loadFromExtension('sonata_admin', array( + use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface; + use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface; + + $container->loadFromExtension('sonata_admin', [ // ... - 'extensions' => array( - 'cmf_core.admin_extension.publish_workflow.publishable' => array( - 'implements' => array( - 'Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface', - ), - ), - 'cmf_core.admin_extension.publish_workflow.time_period' => array( - 'implements' => array( - 'Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface', - ), - ), - ), - )); + 'extensions' => [ + 'cmf_core.admin_extension.publish_workflow.publishable' => [ + 'implements' => [ + PublishableInterface::class, + ], + ], + 'cmf_core.admin_extension.publish_workflow.time_period' => [ + 'implements' => [ + PublishTimePeriodInterface::class, + ], + ], + ], + ]); See the `Sonata Admin extension documentation`_ for more information. diff --git a/bundles/core/templating.rst b/bundles/core/templating.rst index f51d8b74..fe4819c7 100644 --- a/bundles/core/templating.rst +++ b/bundles/core/templating.rst @@ -132,7 +132,7 @@ Code examples next {% endif %} - {% for news in cmf_children(parent=cmfMainContent, class='Acme\\DemoBundle\\Document\\NewsItem')|reverse %} + {% for news in cmf_children(parent=cmfMainContent, class='AppBundle\\Document\\NewsItem')|reverse %}
  • {{ news.title }} ({{ news.publishStartDate | date('Y-m-d') }})
  • {% endfor %} @@ -185,7 +185,7 @@ Code examples $app->getRequest()->attributes->get('_route_params'), array_merge( $app->getRequest()->query->all(), - array('_locale' => 'de') + ['_locale' => 'de'] ) ) ?>">DE @@ -197,7 +197,7 @@ Code examples $app->getRequest()->attributes->get('_route_params'), array_merge( $app->getRequest()->query->all(), - array('_locale' => 'fr') + ['_locale' => 'fr'] ) ) ?>">FR @@ -208,7 +208,7 @@ Code examples When you use the ``class`` argument, do not forget that Twig will simply *ignore* single backslashes. If you would write - ``Acme\DemoBundle\Document\NewsItem``, this will make the cmf look - for the class AcmeDemoBundleDocumentNewsItem which will result in an + ``AppBundle\Document\NewsItem``, this will make the cmf look + for the class ``AppBundleDocumentNewsItem`` which will result in an empty list. What you need to write in the template is - ``Acme\\DemoBundle\\Document\\NewsItem``. + ``AppBundle\\Document\\NewsItem``.