From a31dd8db7e38634d21e4d067929c4f12d95c539a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 27 Mar 2019 16:39:27 +0100 Subject: [PATCH 1/3] Documented the deprecation of the Templating component --- form/create_custom_field_type.rst | 6 ++++++ reference/configuration/framework.rst | 6 ++++++ reference/dic_tags.rst | 5 +++++ templating/PHP.rst | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst index 9023f0c9d40..5a582679a64 100644 --- a/form/create_custom_field_type.rst +++ b/form/create_custom_field_type.rst @@ -267,6 +267,12 @@ link for details), create a ``shipping_widget`` block to handle this: ], ]); + .. deprecated:: 4.3 + + The integration of the Templating component in FrameworkBundle has been + deprecated since version 4.3 and will be removed in 5.0. Form theming with + PHP templates will no longer be supported and you'll need to use Twig instead. + Using the Field Type -------------------- diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0f54eecbf74..bae4ddbf899 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1554,6 +1554,12 @@ resources **type**: ``string[]`` **default**: ``['FrameworkBundle:Form']`` +.. deprecated:: 4.3 + + The integration of the Templating component in FrameworkBundle has been + deprecated since version 4.3 and will be removed in 5.0. Form theming with + PHP templates will no longer be supported and you'll need to use Twig instead. + A list of all resources for form theming in PHP. This setting is not required if you're :ref:`using the Twig format for your themes `. diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 1aca88bb444..5b8cacddeb5 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -794,6 +794,11 @@ templating.helper **Purpose**: Make your service available in PHP templates +.. deprecated:: 4.3 + + The ``templating.helper`` tag is deprecated since version 4.3 and will be + removed in 5.0; use Twig instead. + To enable a custom template helper, add it as a regular service in one of your configuration, tag it with ``templating.helper`` and define an ``alias`` attribute (the helper will be accessible via this alias in the diff --git a/templating/PHP.rst b/templating/PHP.rst index bc9a0d61149..7acd7f5bbce 100644 --- a/templating/PHP.rst +++ b/templating/PHP.rst @@ -4,6 +4,12 @@ How to Use PHP instead of Twig for Templates ============================================ +.. deprecated:: 4.3 + + The integration of the Templating component in FrameworkBundle has been + deprecated since version 4.3 and will be removed in 5.0. PHP templates will + no longer be supported and you'll need to use Twig instead. + Symfony defaults to Twig for its template engine, but you can still use plain PHP code if you want. Both templating engines are supported equally in Symfony. Symfony adds some nice features on top of PHP to make writing From 2dc7e829501a66731f9c47572b39c2f5072a06c3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Apr 2019 17:46:36 +0200 Subject: [PATCH 2/3] Finish the PR --- templating/PHP.rst | 6 ++++++ templating/hinclude.rst | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/templating/PHP.rst b/templating/PHP.rst index 7acd7f5bbce..d0b218292b6 100644 --- a/templating/PHP.rst +++ b/templating/PHP.rst @@ -23,6 +23,12 @@ templates with PHP more powerful. Rendering PHP Templates ----------------------- +.. deprecated:: 4.3 + + The integration of the Templating component in FrameworkBundle has been + deprecated since version 4.3 and will be removed in 5.0. PHP templates will + no longer be supported and you'll need to use Twig instead. + If you want to use the PHP templating engine, first install the templating component: .. code-block:: terminal diff --git a/templating/hinclude.rst b/templating/hinclude.rst index 675fd268607..396dec13643 100644 --- a/templating/hinclude.rst +++ b/templating/hinclude.rst @@ -67,7 +67,7 @@ in your application configuration: # config/packages/framework.yaml framework: # ... - templating: + fragments: hinclude_default_template: hinclude.html.twig .. code-block:: xml @@ -83,7 +83,7 @@ in your application configuration: - + @@ -92,13 +92,19 @@ in your application configuration: // config/packages/framework.php $container->loadFromExtension('framework', [ // ... - 'templating' => [ + 'fragments' => [ 'hinclude_default_template' => [ 'hinclude.html.twig', ], ], ]); +.. versionadded:: 4.3 + + The ``framework.fragments.hinclude_default_template`` option was introduced + in Symfony 4.3. In previous Symfony versions it was called + ``framework.templating.hinclude_default_template``. + You can define default templates per ``render()`` function (which will override any global default template that is defined): From 2f349d29e16508a641ed2ce70495408dcec6339d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Apr 2019 17:48:05 +0200 Subject: [PATCH 3/3] Removed an unneeded PHP example --- form/create_custom_field_type.rst | 53 ------------------------------- 1 file changed, 53 deletions(-) diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst index 5a582679a64..b67c0a330d8 100644 --- a/form/create_custom_field_type.rst +++ b/form/create_custom_field_type.rst @@ -185,8 +185,6 @@ link for details), create a ``shipping_widget`` block to handle this: rules). Further, the main config file should point to the custom form template so that it's used when rendering all forms. - When using Twig this is: - .. configuration-block:: .. code-block:: yaml @@ -222,57 +220,6 @@ link for details), create a ``shipping_widget`` block to handle this: ], ]); - For the PHP templating engine, your configuration should look like this: - - .. configuration-block:: - - .. code-block:: yaml - - # config/packages/framework.yaml - framework: - templating: - form: - resources: - - ':form:fields.html.php' - - .. code-block:: xml - - - - - - - - - :form:fields.html.php - - - - - - .. code-block:: php - - // config/packages/framework.php - $container->loadFromExtension('framework', [ - 'templating' => [ - 'form' => [ - 'resources' => [ - ':form:fields.html.php', - ], - ], - ], - ]); - - .. deprecated:: 4.3 - - The integration of the Templating component in FrameworkBundle has been - deprecated since version 4.3 and will be removed in 5.0. Form theming with - PHP templates will no longer be supported and you'll need to use Twig instead. - Using the Field Type --------------------