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

[core-bundle] change doc to best practices #796

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions bundles/core/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ is the following configuration:

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'persistence' => array(
'phpcr' => array(
$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``
.......
Expand Down Expand Up @@ -104,15 +104,15 @@ is the following configuration:

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'persistence' => array(
'phpcr' => array(
$container->loadFromExtension('cmf_core', [
'persistence' => [
'phpcr' => [
'enabled' => false,
'manager_name' => null,
'use_sonata_admin' => 'auto',
),
),
));
],
],
]);

``enabled``
"""""""""""
Expand Down Expand Up @@ -240,14 +240,14 @@ bundles that use this configuration:

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'multilang' => array(
'locales' => array(
$container->loadFromExtension('cmf_core', [
'multilang' => [
'locales' => [
'en',
'fr',
),
),
));
],
],
]);

``locales``
...........
Expand Down Expand Up @@ -291,14 +291,14 @@ only published routes and content can be accessed.

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'publish_workflow' => array(
$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
------------
Expand Down Expand Up @@ -341,21 +341,21 @@ This section configures the Sonata Admin Extensions, see:

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'sonata_admin' => array(
'extensions' => array(
'publishable' => array(
$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``
~~~~~~~~~~~~~~
Expand Down
8 changes: 4 additions & 4 deletions bundles/core/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="%team%">Team</a> and <a href="%more%">More</a> 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.
68 changes: 35 additions & 33 deletions bundles/core/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ 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

<?xml version="1.0" charset="UTF-8" ?>
<!-- app/config/config.xml -->
<container xmlns="http://symfony.com/schema/dic/services">

<config xmlns="http://cmf.symfony.com/schema/dic/core">
Expand All @@ -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:

Expand Down Expand Up @@ -76,23 +80,21 @@ enforce a single translation strategy for all documents:

<config xmlns="http://cmf.symfony.com/schema/dic/core">
<persistence>
<phpcr
translation-strategy="attribute"
/>
<phpcr translation-strategy="attribute"/>
</persistence>
</config>

</container>

.. code-block:: php

$container->loadFromExtension('cmf_core', array(
'persistence' => array(
'phpcr' => array(
$container->loadFromExtension('cmf_core', [
'persistence' => [
'phpcr' => [
'translation_strategy' => 'attribute',
),
),
));
],
],
]);

.. caution::

Expand Down Expand Up @@ -152,17 +154,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.

Expand Down Expand Up @@ -209,16 +211,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.

Expand Down
40 changes: 20 additions & 20 deletions bundles/core/publish_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -305,7 +305,7 @@ you can lower the priority of those voters:
.. code-block:: yaml

services:
security.publishable_voter:
app.publishable_voter:
class: "AppBundle\Security\PublishableVoter"
tags:
- { name: cmf_published_voter, priority: 30 }
Expand All @@ -314,7 +314,7 @@ you can lower the priority of those voters:

<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">
<service id="security.publishable_voter"
<service id="app.publishable_voter"
class="AppBundle\Security\PublishableVoter">

<tag name="cmf_published_voter" priority="30"/>
Expand All @@ -327,10 +327,10 @@ you can lower the priority of those voters:

$container
->register(
'security.publishable_voter',
'app.publishable_voter',
'AppBundle\Security\PublishableVoter'
)
->addTag('cmf_published_voter', array('priority' => 30))
->addTag('cmf_published_voter', ['priority' => 30])
;

The workflow checker will create an
Expand Down Expand Up @@ -413,21 +413,21 @@ 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.publish_workflow.publishable' => array(
'implements' => array(
'extensions' => [
'cmf_core.admin_extension.publish_workflow.publishable' => [
'implements' => [
'Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface',
),
),
'cmf_core.admin_extension.publish_workflow.time_period' => array(
'implements' => array(
],
],
'cmf_core.admin_extension.publish_workflow.time_period' => [
'implements' => [
'Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface',
),
),
),
));
],
],
],
]);

See the `Sonata Admin extension documentation`_ for more information.

Expand Down
12 changes: 6 additions & 6 deletions bundles/core/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Code examples
<span style="float: right; padding-right: 40px;"><a href="{{ path(next) }}">next</a></span>
{% 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 %}
<li><a href="{{ path(news) }}">{{ news.title }}</a> ({{ news.publishStartDate | date('Y-m-d') }})</li>
{% endfor %}

Expand Down Expand Up @@ -185,7 +185,7 @@ Code examples
$app->getRequest()->attributes->get('_route_params'),
array_merge(
$app->getRequest()->query->all(),
array('_locale' => 'de')
['_locale' => 'de']
)
)
?>">DE</a>
Expand All @@ -197,7 +197,7 @@ Code examples
$app->getRequest()->attributes->get('_route_params'),
array_merge(
$app->getRequest()->query->all(),
array('_locale' => 'fr')
['_locale' => 'fr']
)
)
?>">FR</a>
Expand All @@ -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``.