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

Commit 61a535d

Browse files
committed
Fixed language and code
1 parent f198610 commit 61a535d

File tree

5 files changed

+81
-53
lines changed

5 files changed

+81
-53
lines changed

bundles/core/dependency_injection_tags.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ service must have the ``setRequest`` method or you will get a fatal error::
2424
}
2525
}
2626

27-
.. note::
27+
.. caution::
2828

2929
You should only use this tag on services that will be needed on every
3030
request. If you use this tag excessively you will run into performance
@@ -33,16 +33,16 @@ service must have the ``setRequest`` method or you will get a fatal error::
3333
code when you actually need the request.
3434

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

4141
cmf_published_voter
4242
~~~~~~~~~~~~~~~~~~~
4343

4444
Used to activate :ref:`custom voters <bundle-core-workflow_custom_voters>` for the
45-
:ref:`publish workflow <bundle-core-publish_workflow>` . Tagging a service with
45+
:ref:`publish workflow <bundle-core-publish_workflow>`. Tagging a service with
4646
``cmf_published_voter`` integrates it into the access decision of the publish
4747
workflow.
4848

bundles/core/introduction.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ CoreBundle
88
other CMF bundles.
99

1010
One of the provided features is an interface and implementation of a publish
11-
workflow checker with an accompanying interface that models can implement that
12-
want to support this checker.
11+
workflow checker with an accompanying interface that models can implement if
12+
they want to support this checker.
1313

14-
Furthermore it provides a twig helper exposing several useful functions for
14+
Furthermore, it provides a twig helper exposing several useful functions for
1515
twig templates to interact with PHPCR-ODM documents.
1616

17-
Finally it most of its configuration settings are automatically applied as
17+
Finally, most of its configuration settings are automatically applied as
1818
defaults for most of the other CMF Bundles.
1919

2020
Installation

bundles/core/multilang.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ configuration in the ``sonata_admin`` section of your project configuration:
4747
4848
// app/config/config.php
4949
$container->loadFromExtension('sonata_admin', array(
50+
// ...
5051
'extensions' => array(
5152
'cmf_core.admin_extension.translatable' => array(
5253
'implements' => array(

bundles/core/publish_workflow.rst

Lines changed: 64 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ site. This is similar to the `Symfony2 Security component`_. But contrary to the
1111
security context, the publish check can be executed even when no firewall is in
1212
place and the security context thus has no token (see `Symfony2 Authorization`_).
1313

14-
The publish workflow is also tied into the security workflow: The core bundle
14+
The publish workflow is also tied into the security workflow: The CoreBundle
1515
registers a security voter that forwards security checks to the publish
1616
workflow. This means that if you always have a firewall, you can just use
1717
the normal security context and the twig function ``is_granted`` to check for
1818
publication.
1919

20-
A good introduction to the Symfony core security is the `Security Chapter`_ in
21-
the Symfony2 book.
20+
.. tip::
21+
22+
A good introduction to the Symfony core security can be found in the
23+
`Security Chapter`_ of the Symfony2 book.
2224

2325
Check if Content is Published
2426
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2527

26-
The Bundle provides the ``cmf_core.publish_workflow.checker`` service which
28+
The Bundle provides the ``cmf_core.publish_workflow.checker`` service, which
2729
implements the :class:`Symfony\\Component\\Security\\Core\\SecurityContextInterface`
28-
of the Symfony security component. The method to check publication is
30+
of the Symfony Security component. The method to check publication is
2931
:method:`Symfony\\Component\\Security\\Core\\SecurityContextInterface::isGranted`,
3032
same as with the security context.
3133

@@ -55,9 +57,15 @@ given to editors. The default name of the role is ``ROLE_CAN_VIEW_NON_PUBLISHED`
5557
.. code-block:: xml
5658
5759
<!-- app/config/security.xml -->
58-
<config xmlns="http://symfony.com/schema/dic/security">
59-
<role id="ROLE_EDITOR">ROLE_CAN_VIEW_NON_PUBLISHED</role>
60-
</config>
60+
<?xml version="1.0" encoding="UTF-8" ?>
61+
<srv:container xmlns="http://symfony.com/schema/dic/security"
62+
xmlns:srv="http://symfony.com/schema/dic/services">
63+
64+
<config>
65+
<role id="ROLE_EDITOR">ROLE_CAN_VIEW_NON_PUBLISHED</role>
66+
</config>
67+
68+
</srv:container>
6169
6270
.. code-block:: php
6371
@@ -76,18 +84,21 @@ the path in question - he will have the permission to view unpublished content a
7684
// check if current user is allowed to see this document
7785
$publishWorkflowChecker = $container->get('cmf_core.publish_workflow.checker');
7886
if ($publishWorkflowChecker->isGranted(
79-
PublishWorkflowChecker::VIEW_ATTRIBUTE,
80-
$document)
87+
PublishWorkflowChecker::VIEW_ATTRIBUTE,
88+
$document
89+
)
8190
) {
8291
// ...
8392
}
93+
8494
// check if the document is published. even if the current role would allow
8595
// to see the document, this will still return false if the documet is not
8696
// published
8797
if ($publishWorkflowChecker->isGranted(
88-
PublishWorkflowChecker::VIEW_ANONYMOUS_ATTRIBUTE,
89-
$document
90-
)) {
98+
PublishWorkflowChecker::VIEW_ANONYMOUS_ATTRIBUTE,
99+
$document
100+
)
101+
) {
91102
// ...
92103
}
93104

@@ -113,7 +124,7 @@ To check publication in a template, use the twig function ``cmf_is_published``:
113124
{# ... output the document #}
114125
{% endif %}
115126
116-
.. code-block:: php
127+
.. code-block:: html+php
117128

118129
<!-- check if document is published, regardless of current users role -->
119130
<?php if ($view['cmf']->isPublished($page)) : ?>
@@ -158,14 +169,14 @@ content is still considered published.
158169
Publish Voters
159170
~~~~~~~~~~~~~~
160171

161-
A voter has to implement the
172+
A voter must implement the
162173
:class:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface`.
163-
It will get passed a content object and has to decide whether it is published
174+
A content object will be passed and it has to decide whether it is published
164175
according to its rules. The CoreBundle provides a couple of generic voters
165-
that check the content for having an interface exposing the methods they need.
166-
If the content implements the interface, they check the parameter and return
167-
``ACCESS_GRANTED`` or ``ACCESS_DENIED``, otherwise they return
168-
``ACCESS_ABSTAIN``.
176+
(`PublishableVoter`_ and `TimePeriodVoter`_) that check the content for having
177+
an interface exposing the methods they need. If the content implements the
178+
interface, they check the parameter and return ``ACCESS_GRANTED`` or
179+
``ACCESS_DENIED``, otherwise they return ``ACCESS_ABSTAIN``.
169180

170181
As voting is unanimous, each voter returns ``ACCESS_GRANTED`` if its criteria
171182
is met, but if a single voter returns ``ACCESS_DENIED``, the content is
@@ -219,9 +230,14 @@ you can lower the priority of those voters.
219230
220231
.. code-block:: xml
221232
222-
<service id="acme.security.publishable_voter" class="%acme.security.publishable_voter.class%">
223-
<tag name="cmf_published_voter" priority="30"/>
224-
</service>
233+
<?xml version="1.0" encoding="UTF-8" ?>
234+
<container xmlns="http://symfony.com/schema/dic/services">
235+
<service id="acme.security.publishable_voter"
236+
class="%acme.security.publishable_voter.class%">
237+
238+
<tag name="cmf_published_voter" priority="30"/>
239+
</service>
240+
</container>
225241
226242
.. code-block:: php
227243
@@ -235,14 +251,14 @@ you can lower the priority of those voters.
235251
->addTag('cmf_published_voter', array('priority' => 30))
236252
;
237253
238-
As the workflow checker will create an
254+
The workflow checker will create an
239255
:class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken` on
240-
the fly if the security context has none, voters must be able to handle this
241-
situation when accessing the user. Also when accessing the security context,
242-
they first must check if it has a token and otherwise not call it to avoid
243-
triggering an exception. If a voter only gives access if there is a current
244-
user fulfills some requirement, it simply has to return ``ACCESS_DENIED`` if
245-
there is no current user.
256+
the fly if the securty context has none. This means that voters must be able
257+
to handle this situation when accessing the user. Also when accessing the
258+
security context, they first must check if it has a token and otherwise they
259+
should not call it to avoid triggering an exception. If a voter only gives
260+
access if the current user fulfills some requirement, it simply has to return
261+
``ACCESS_DENIED`` if there is no current user.
246262

247263
.. _bundle-core-workflow-request_listener:
248264

@@ -292,24 +308,29 @@ configuration in the ``sonata_admin`` section of your project configuration:
292308
.. code-block:: xml
293309
294310
<!-- app/config/config.xml -->
295-
<config xmlns="http://sonata-project.org/schema/dic/admin">
296-
<!-- ... -->
297-
<extension id="cmf_core.admin_extension.publish_workflow.publishable">
298-
<implement>
299-
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface
300-
</implement>
301-
</extension>
302-
<extension id="cmf_core.admin_extension.publish_workflow.time_period">
303-
<implement>
304-
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface
305-
</implement>
306-
</extension>
307-
</config>
311+
<?xml version="1.0" encoding="UTF-8" ?>
312+
<container xmlns="http://symfony.com/schema/dic/services">
313+
<config xmlns="http://sonata-project.org/schema/dic/admin">
314+
<!-- ... -->
315+
<extension id="cmf_core.admin_extension.publish_workflow.publishable">
316+
<implement>
317+
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface
318+
</implement>
319+
</extension>
320+
321+
<extension id="cmf_core.admin_extension.publish_workflow.time_period">
322+
<implement>
323+
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface
324+
</implement>
325+
</extension>
326+
</config>
327+
</container>
308328
309329
.. code-block:: php
310330
311331
// app/config/config.php
312332
$container->loadFromExtension('sonata_admin', array(
333+
// ...
313334
'extensions' => array(
314335
'cmf_core.admin_extension.publish_workflow.publishable' => array(
315336
'implements' => array(

bundles/core/templating.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Templating
55
----------
66

7+
The CoreBundle also provides a lot of functions to use in templates.
8+
79
Twig
810
~~~~
911

@@ -36,7 +38,9 @@ functions for your templates. The functions respect the
3638
* **cmf_parent_path**: returns the parent path of the provided document
3739
* **cmf_path**: returns the path of the provided document
3840

39-
.. code-block:: jinja
41+
An example of these functions can be:
42+
43+
.. code-block:: html+jinja
4044

4145
{% set page = cmf_find('/some/path') %}
4246

@@ -103,7 +107,9 @@ contains the following methods:
103107
* **getParentPath**: returns the parent path of the provided document
104108
* **getPath**: returns the path of the provided document
105109

106-
.. code-block:: php
110+
An example of these functions can be:
111+
112+
.. code-block:: html+php
107113

108114
<?php $page = $view['cmf']->find('/some/path') ?>
109115

0 commit comments

Comments
 (0)