8000 Merge branch '4.1' · weaverryan/symfony-docs@daf655a · GitHub
[go: up one dir, main page]

Skip to content

Commit daf655a

Browse files
committed
Merge branch '4.1'
* 4.1: Removed a short article about overriding bundle templates Fix configuration-block not working Change form.xxx_bind to form.xxx_submit
2 parents 88ff52b + 8de3a83 commit daf655a

File tree

7 files changed

+34
-57
lines changed

7 files changed

+34
-57
lines changed

_build/redirection_map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,4 @@
388388
/quick_tour/the_controller /quick_tour/the_big_picture
389389
/quick_tour/the_view /quick_tour/flex_recipes
390390
/service_container/service_locators /service_container/service_subscribers_locators
391+
/templating/overriding /bundles/override

bundles/override.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,33 @@ features of a bundle.
1616
and call the :ref:`locateResource() method <http-kernel-resource-locator>`
1717
to turn them into physical paths when needed.
1818

19+
.. _override-templates:
20+
1921
Templates
2022
---------
2123

22-
See :doc:`/templating/overriding`.
24+
Third-party bundle templates can be overridden in the
25+
``<your-project>/templates/bundles/<bundle-name>/`` directory. The new templates
26+
must use the same name and path (relative to ``<bundle>/Resources/views/``) as
27+
the original templates.
28+
29+
For example, to override the ``Resources/views/Registration/confirmed.html.twig``
30+
template from the FOSUserBundle, create this template:
31+
``<your-project>/templates/bundles/FOSUserBundle/Registration/confirmed.html.twig``
32+
33+
.. caution::
34+
35+
If you add a template in a new location, you *may* need to clear your
36+
cache (``php bin/console cache:clear``), even if you are in debug mode.
37+
38+
.. _templating-overriding-core-templates:
39+
40+
.. tip::
41+
42+
Symfony internals use some bundles too, so you can apply the same technique
43+
to override the core Symfony templates. For example, you can
44+
:doc:`customize error pages </controller/error_pages>` overriding TwigBundle
45+
templates.
2346

2447
Routing
2548
-------

controller/error_pages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ logic to determine the template filename:
6565

6666
.. _overriding-or-adding-templates:
6767

68-
To override these templates, simply rely on the standard Symfony method for
69-
:doc:`overriding templates that live inside a bundle </templating/overriding>`:
68+
To override these templates, rely on the standard Symfony method for
69+
:ref:`overriding templates that live inside a bundle <override-templates>` and
7070
put them in the ``templates/bundles/TwigBundle/Exception/`` directory.
7171

7272
A typical project that returns HTML and JSON pages, might look like this:

form/events.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ Name ``FormEvents`` Constant Event's Data
252252
====================== ============================= ===============
253253
``form.pre_set_data`` ``FormEvents::PRE_SET_DATA`` Model data
254254
``form.post_set_data`` ``FormEvents::POST_SET_DATA`` Model data
255-
``form.pre_bind`` ``FormEvents::PRE_SUBMIT`` Request data
256-
``form.bind`` ``FormEvents::SUBMIT`` Normalized data
257-
``form.post_bind`` ``FormEvents::POST_SUBMIT`` View data
255+
``form.pre_submit`` ``FormEvents::PRE_SUBMIT`` Request data
256+
``form.submit`` ``FormEvents::SUBMIT`` Normalized data
257+
``form.post_submit`` ``FormEvents::POST_SUBMIT`` View data
258258
====================== ============================= ===============
259259

260260
Event Listeners

routing/redirect_in_config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ The :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::u
185185
and :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction`
186186
methods accept an additional argument called ``keepRequestMethod``. When it's
187187
set to ``true``, temporary redirects use ``307`` code instead of ``302`` and
188-
permanent redirects use ``308`` code instead of ``301``::
188+
permanent redirects use ``308`` code instead of ``301``:
189189

190190
.. configuration-block::
191191

templating.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ By default, templates can live in two different locations:
360360
``templates/``
361361
The application's ``views`` directory can contain application-wide base templates
362362
(i.e. your application's layouts and templates of the application bundle) as
363-
well as templates that override third party bundle templates
364-
(see :doc:`/templating/overriding`).
363+
well as templates that :ref:`override third party bundle templates <override-templates>`.
365364

366365
``vendor/path/to/CoolBundle/Resources/views/``
367366
Each third party bundle houses its templates in its ``Resources/views/``
@@ -405,10 +404,8 @@ for several types of templates, each which lives in a specific location:
405404
is missing (e.g. ``Blog``), the template lives at
406405
``Resources/views/layout.html.twig`` inside AcmeBlogBundle.
407406

408-
In the :doc:`/templating/overriding` section, you'll find out how each
409-
template living inside the AcmeBlogBundle, for example, can be overridden
410-
by placing a template of the same name in the ``templates/bundles/AcmeBlogBundle/``
411-
directory. This gives the power to override templates from any vendor bundle.
407+
Using this namespaced syntax instead of the real file paths allows applications
408+
to :ref:`override templates that live inside any bundle <override-templates>`.
412409

413410
Template Suffix
414411
~~~~~~~~~~~~~~~

templating/overriding.rst

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0