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

Commit 0a33aa8

Browse files
committed
Merge remote-tracking branch 'origin/1.3'
2 parents b83228a + 671e610 commit 0a33aa8

16 files changed

+201
-19
lines changed

book/handling_multilang.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,4 +347,4 @@ save the edited document in the same language as it was loaded.
347347
.. _`this discussion about ICU`: https://github.com/symfony/symfony/issues/5279#issuecomment-11710480
348348
.. _`cmf-sandbox config.yml file`: https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml
349349
.. _`PHPCR-ODM documentation on multi-language`: http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/reference/multilang.html
350-
.. _`issue`: https://github.com/symfony-cmf/CreateBundle/issues/39
350+
.. _`issue`: https://github.com/symfony-cmf/create-bundle/issues/39

bundles/block/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,4 @@ Read on
420420
.. _`Symfony CMF Sandbox`: https://github.com/symfony-cmf/cmf-sandbox
421421
.. _`prepended configuration`: https://symfony.com/doc/current/components/dependency_injection/compilation.html#prepending-configuration-passed-to-the-extension
422422
.. _`SonataBlockBundle`: https://github.com/sonata-project/SonataBlockBundle
423-
.. _`discussion how to fix this`: https://github.com/symfony-cmf/BlockBundle/issues/143
423+
.. _`discussion how to fix this`: https://github.com/symfony-cmf/block-bundle/issues/143

bundles/content/exposing_content_via_rest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ for details.
154154
.. _`FOSRestBundle view layer`: https://symfony.com/doc/master/bundles/FOSRestBundle/2-the-view-layer.html
155155
.. _Composer: https://getcomposer.org/
156156
.. _`documentation of the JMS serializer`: http://jmsyst.com/libs/#serializer
157-
.. _`default response format changed between 1.0 and 1.1 of the ContentBundle`: https://github.com/symfony-cmf/ContentBundle/pull/91
157+
.. _`default response format changed between 1.0 and 1.1 of the ContentBundle`: https://github.com/symfony-cmf/content-bundle/pull/91

bundles/core/templating.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ Basic repository operations
2929

3030
* **cmf_find|find(path)**: Get the document for the provided path or null if not found.
3131
No publish workflow check is done.
32+
* **cmf_find_translation|findTranslation($pathOrDocument, $locale, $fallback = true)**: Get the document translation
33+
for the provided path/document and locale or null if not found. The document will stay in the last requested locale
34+
for the rest of the request.
35+
No publish workflow check is done.
3236
* **cmf_find_many|findMany($paths, $limit = false, $offset = false, $ignoreRole = false, $class = false)**:
3337
Get a list of documents for the provided paths.
3438
* **cmf_nodename|getNodeName($document)**: Get the node name of the provided document.
3539
* **cmf_path|getPath($document)**: Get the path of the provided document.
3640
* **cmf_parent_path|getParentPath($document)**: Get the path of the parent of the provided document.
3741

42+
.. versionadded:: 1.3.1
43+
The cmf_find_translation twig function has been added in version 1.3.1 of the CMF CoreBundle.
44+
3845
Walking the PHPCR tree
3946
......................
4047

bundles/create/other-editors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ editor parameter:
114114
help, please see the github issue for `aloha`_ integration.
115115

116116
.. _`Aloha editor`: http://www.alohaeditor.org/Content.Node/index.html
117-
.. _`aloha`: https://github.com/symfony-cmf/CreateBundle/issues/32
117+
.. _`aloha`: https://github.com/symfony-cmf/create-bundle/issues/32

bundles/media/form_types.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ transformers.
1010
.. caution::
1111

1212
The form types described in this chapter are only available if the PHPCR storage
13-
is activated. Implementation for other storage systems would be welcome
13+
is activated. Implementation for other storage systems would be welcome
1414
contributions.
1515

1616
A default twig template is also included for these form types.
17-
To use it you will need to add the ``fields.html.twig`` template from the
17+
To use it you will need to add the ``fields.html.twig`` template from the
1818
MediaBundle to the ``form.resources`` section in twig config:
1919

2020
.. configuration-block::
@@ -153,13 +153,13 @@ cmf_media_file
153153

154154
.. versionadded: 1.3
155155
The ``cmf_media_file`` form type was introduced in MediaBundle 1.3.
156-
156+
157157
The ``cmf_media_file`` form maps to an object that implements the
158158
``Symfony\Cmf\Bundle\MediaBundle\FileInterface``.
159159
It renders as a file upload button with a link for downloading the existing
160160
file, if any.
161161

162162
.. _`LiipImagineBundle`: https://github.com/liip/LiipImagineBundle
163163
.. _`trying to make this automatic`: https://groups.google.com/forum/?fromgroups=#!topic/symfony2/CrooBoaAlO4
164-
.. _`ImagineBlock::setImage`: https://github.com/symfony-cmf/BlockBundle/blob/master/Doctrine/Phpcr/ImagineBlock.php#L121
165-
.. _`MediaBundle issue`: https://github.com/symfony-cmf/MediaBundle/issues/9
164+
.. _`ImagineBlock::setImage`: https://github.com/symfony-cmf/block-bundle/blob/master/Doctrine/Phpcr/ImagineBlock.php#L121
165+
.. _`MediaBundle issue`: https://github.com/symfony-cmf/media-bundle/issues/9

bundles/media/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The media bundle contains a Twig extension, it contains the following functions:
217217
<img src="<?php echo $view['cmf_media']->displayUrl($image) ?>" alt="" />
218218

219219
If :doc:`LiipImagine <adapters/liip_imagine>` is enabled you can also pass :doc:`filter </bundles/LiipImagineBundle/filters>` and `runtime_config` like below:
220-
220+
221221
.. code-block:: html+jinja
222222

223223
<a href="{{ cmf_media_display_url(file, {
@@ -288,7 +288,7 @@ and Symfony bundles:
288288

289289
.. _`symfony-cmf/media-bundle`: https://packagist.org/packages/symfony-cmf/media-bundle
290290
.. _`with composer`: https://getcomposer.org
291-
.. _`MediaBundle`: https://github.com/symfony-cmf/MediaBundle#readme
291+
.. _`MediaBundle`: https://github.com/symfony-cmf/media-bundle#readme
292292
.. _`KnpLabs/Gaufrette`: https://github.com/KnpLabs/Gaufrette
293293
.. _`phpcr/phpcr-utils`: https://github.com/phpcr/phpcr-utils
294294
.. _`jms/serializer-bundle`: https://github.com/schmittjoh/JMSSerializerBundle

bundles/routing/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ For more information on Routing in the Symfony CMF, please refer to:
106106

107107
.. _`with composer`: https://getcomposer.org
108108
.. _`symfony-cmf/routing-bundle`: https://packagist.org/packages/symfony-cmf/routing-bundle
109-
.. _`RoutingBundle`: https://github.com/symfony-cmf/RoutingBundle#readme
109+
.. _`RoutingBundle`: https://github.com/symfony-cmf/routing-bundle#readme
110110
.. _`PHPCR-ODM`: http://www.doctrine-project.org/projects/phpcr-odm.html
111111
.. _`documentation for DependencyInjection tags`: https://symfony.com/doc/2.1/reference/dic_tags.html
112112
.. _`Routing`: https://symfony.com/doc/current/components/routing/introduction.html

bundles/seo/alternate_locale.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Alternate Locale Handling
2+
=========================
3+
4+
.. versionadded:: 1.1
5+
Support for handling alternate locales was added in SeoBundle version 1.1.0.
6+
7+
Alternate locales are a way of telling search engines how to find translations
8+
of the current page. The SeoBundle provides a way to manage alternate locales
9+
and render them together with the other SEO information.
10+
11+
When the alternate locale handling is set up and found alternates, you will
12+
find links like the following in the ``<head>`` part of your HTML pages:
13+
14+
.. code-block:: html
15+
16+
<link rel="alternate" href="/fr/le-titre" hreflang="fr">
17+
<link rel="alternate" href="/de/der-titel" hreflang="de">
18+
19+
When using PHPCR-ODM, there is almost no work to do, as the bundle can use the
20+
Doctrine meta data to figure out which translations exists for a content. More
21+
information on translating content with the PHPCR-ODM is in the chapter
22+
:doc:`Doctrine PHPCR-ODM Multilanguage Support <../phpcr_odm/multilang>`.
23+
24+
Setting Up Alternate Locale Support
25+
-----------------------------------
26+
27+
Enable alternate locale support:
28+
29+
.. configuration-block::
30+
31+
.. code-block:: yaml
32+
33+
# app/config/config.yml
34+
cmf_seo:
35+
alternate_locale: ~
36+
37+
.. code-block:: xml
38+
39+
<!-- app/config/config.xml -->
40+
<?xml version="1.0" encoding="UTF-8" ?>
41+
<container xmlns="http://symfony.com/schema/dic/services">
42+
<config xmlns="http://cmf.symfony.com/schema/dic/seo">
43+
<alternate-locale />
44+
</config>
45+
</container>
46+
47+
.. code-block:: php
48+
49+
$container->loadFromExtension('cmf_seo', array(
50+
'alternate_locale' => true,
51+
));
52+
53+
If you are using PHPCR-ODM, enabling ``phpcr: ~`` in the seo bundle
54+
configuration will activate a listener that extracts the alternate locales
55+
from the PHPCR-ODM meta data. For other storage systems, you will need to
56+
write a provider and configure the bundle to use that provider - see below.
57+
58+
Rendering Alternate Locales
59+
---------------------------
60+
61+
The alternate locales are rendered together with the other SEO metadata by the
62+
twig function ``sonata_seo_metadatas``.
63+
64+
Creating a Custom Alternate Locales Provider
65+
--------------------------------------------
66+
67+
The alternate locale provider is asked to provide translated URLs for a content
68+
object. The bundle comes with a provider for PHPCR-ODM. For other persistence
69+
layers or custom requirements on the translated URLs you need to create your
70+
own provider implementing the ``AlternateLocaleProviderInterface``. For some
71+
inspiration, have a look at
72+
``Symfony\Cmf\Bundle\SeoBundle\Doctrine\Phpcr\AlternateLocaleProvider``.
73+
74+
Define a service for your provider, so that you can configure the seo bundle to
75+
use your custom alternate locale provider instead of the default one. Set the
76+
``alternate_locale.provider_id`` to the service you just created:
77+
78+
.. configuration-block::
79+
80+
.. code-block:: yaml
81+
82+
# app/config/config.yml
83+
cmf_seo:
84+
alternate_locale:
85+
provider_id: alternate_locale.provider
86+
87+
.. code-block:: xml
88+
89+
<!-- app/config/config.xml -->
90+
<?xml version="1.0" encoding="UTF-8" ?>
91+
<container xmlns="http://symfony.com/schema/dic/services">
92+
<config xmlns="http://cmf.symfony.com/schema/dic/seo">
93+
<alternate-locale provider-id="alternate_locale.provider" />
94+
</config>
95+
</container>
96+
97+
.. code-block:: php
98+
99+
$container->loadFromExtension('cmf_seo', array(
100+
'alternate_locale' => array (
101+
'provider_id' => 'alternate_locale.provider',
102+
),
103+
));
104+
105+
.. versionadded:: 1.2
106+
When :doc:`Sitemaps <sitemap>` are enabled, alternate locales are also
107+
added to the Sitemap.

bundles/seo/configuration.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,52 @@ routes, use:
353353
),
354354
),
355355
));
356+
357+
``alternate_locale``
358+
~~~~~~~~~~~~~~~~~~~~
359+
360+
.. versionadded:: 1.1
361+
Support for alternate locales was added in version 1.1 of the SeoBundle.
362+
363+
.. configuration-block::
364+
365+
.. code-block:: yaml
366+
367+
# app/config/config.yml
368+
cmf_seo:
369+
alternate_locale:
370+
enabled: true
371+
provider_id: app.alternate_locale.provider
372+
373+
.. code-block:: xml
374+
375+
<!-- app/config/config.xml -->
376+
<?xml version="1.0" encoding="UTF-8" ?>
377+
<container xmlns="http://symfony.com/schema/dic/services">
378+
<config xmlns="http://cmf.symfony.com/schema/dic/seo">
379+
<alternate-locale enabled="true" provider-id="app.alternate_locale.provider" />
380+
</config>
381+
</container>
382+
383+
.. code-block:: php
384+
385+
$container->loadFromExtension('cmf_seo', array(
386+
'alternate_locale' => array (
387+
'enabled' => true,
388+
'provider_id' => app.alternate_locale.provider,
389+
),
390+
));
391+
392+
``enabled``
393+
"""""""""""
394+
395+
**type**: ``boolean`` **default**: ``true``
396+
397+
Whether or not the the :ref:`bundles-seo-alternate-locale` should be loaded
398+
399+
``provider_id``
400+
"""""""""""""""
401+
402+
**type**: ``string`` **default**: ``null``
403+
404+
Specify the service id of a custom :doc:`AlternateLocaleProvider <../seo/alternate_locale>`.

0 commit comments

Comments
 (0)