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

[core] change doc to best practices #811

Merged
merged 1 commit into from
Feb 4, 2017
Merged
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
83 changes: 49 additions & 34 deletions bundles/core/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ is the following configuration:

.. code-block:: yaml

# app/config/config.yml
cmf_core:
persistence:
phpcr:
Expand All @@ -35,6 +36,7 @@ is the following configuration:

.. code-block:: xml

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

Expand All @@ -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``
.......
Expand All @@ -78,6 +81,7 @@ is the following configuration:

.. code-block:: yaml

# app/config/config.yml
cmf_core:
persistence:
orm:
Expand All @@ -87,6 +91,7 @@ is the following configuration:

.. code-block:: xml

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

Expand All @@ -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``
"""""""""""
Expand Down Expand Up @@ -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

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

Expand All @@ -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``
...........
Expand All @@ -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
Expand All @@ -276,6 +286,7 @@ only published routes and content can be accessed.

.. code-block:: xml

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

Expand All @@ -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
------------
Expand All @@ -313,6 +325,7 @@ This section configures the Sonata Admin Extensions, see:

.. code-block:: yaml

# app/config/config.yml
cmf_core:
sonata_admin:
extensions:
Expand All @@ -325,6 +338,7 @@ This section configures the Sonata Admin Extensions, see:

.. code-block:: xml

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

Expand All @@ -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``
~~~~~~~~~~~~~~
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.
71 changes: 38 additions & 33 deletions bundles/core/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

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 All @@ -64,35 +68,36 @@ enforce a single translation strategy for all documents:

.. code-block:: yaml

# app/config/config.yml
cmf_core:
persistence:
phpcr:
translation_strategy: attribute

.. code-block:: xml

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

<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(
// app/config/config.php
$container->loadFromExtension('cmf_core', [
'persistence' => [
'phpcr' => [
'translation_strategy' => 'attribute',
),
),
));
],
],
]);

.. caution::

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
Loading