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

restructured CoreBundle docs #270

Merged
merged 2 commits into from
Sep 28, 2013
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
596 changes: 0 additions & 596 deletions bundles/core.rst

This file was deleted.

52 changes: 52 additions & 0 deletions bundles/core/dependency_injection_tags.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.. index::
single: Dependency Injection Tags; CoreBundle

Dependency Injection Tags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an index directive:

.. index::
    single: Dependency Injection Tags; CoreBundle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

-------------------------

cmf_request_aware
~~~~~~~~~~~~~~~~~

If you have services that need the request (e.g. for the publishing workflow
or current menu item voters), you can tag them with ``cmf_request_aware`` to
have a kernel listener inject the request. Any class used in such a tagged
service must have the ``setRequest`` method or you will get a fatal error::

use Symfony\Component\HttpFoundation\Request;

class MyClass
{
private $request;

public function setRequest(Request $request)
{
$this->request = $request;
}
}

.. caution::

You should only use this tag on services that will be needed on every
request. If you use this tag excessively you will run into performance
issues. For seldom used services, you can inject the container in the
service definition and call ``$this->container->get('request')`` in your
code when you actually need the request.

For Symfony 2.3, this tag is automatically translated to a
`synchronized service`_ but Symfony 2.2 does not have that feature, so you can
use this tag for bundles that you want to be able to work with Symfony 2.2. In
custom applications that run with Symfony 2.3, there is no need for this tag,
just use the synchronized service feature.

cmf_published_voter
~~~~~~~~~~~~~~~~~~~

Used to activate :ref:`custom voters <bundle-core-workflow_custom_voters>` for the
:ref:`publish workflow <bundle-core-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`: http://symfony.com/doc/current/cookbook/service_container/scopes.html#using-a-synchronized-service
11 changes: 11 additions & 0 deletions bundles/core/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CoreBundle
==========

.. toctree::
:maxdepth: 2

introduction
publish_workflow
dependency_injection_tags
templating
multilang
36 changes: 36 additions & 0 deletions bundles/core/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. index::
single: Core; Bundles

CoreBundle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. index::
    single: Core; Bundles

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

==========

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.

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.

Installation
------------

You can install the bundle in 2 different ways:

* Use the official Git repository (https://github.com/symfony-cmf/CoreBundle);
* Install it via Composer (``symfony-cmf/core-bundle`` on `Packagist`_).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may missed my comment, or you are working on it, but I like to have something like:

Sections
--------

* :doc:`...`
* :doc:`...`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

Sections
--------

* :doc:`publish_workflow`
* :doc:`dependency_injection_tags`
* :doc:`templating`
* :doc:`multilang`

.. _`Packagist`: https://packagist.org/packages/symfony-cmf/core-bundle
62 changes: 62 additions & 0 deletions bundles/core/multilang.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.. index::
single: Multi-Language; CoreBundle

Multi-language support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. index::
    single: Multi-Language; CoreBundle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

----------------------

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

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

<config xmlns="http://sonata-project.org/schema/dic/admin">
<!-- ... -->
<extension id="cmf_core.admin_extension.translatable">
<implement>
Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface
</implement>
</extension>
</config>

</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('sonata_admin', array(
// ...
'extensions' => array(
'cmf_core.admin_extension.translatable' => array(
'implements' => array(
'Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface',
),
),
),
));

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

.. _`Sonata Admin extension documentation`: http://sonata-project.org/bundles/admin/master/doc/reference/extensions.html
Loading