Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Documented the deprecation of the Templating component#11231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall 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
47 changes: 0 additions & 47 deletionsform/create_custom_field_type.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -222,51 +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

<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:templating>
<framework:form>
<framework:resource>:form:fields.html.php</twig:resource>
</framework:form>
</framework:templating>
</framework:config>
</container>

.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'templating' => [
'form' => [
'resources' => [
':form:fields.html.php',
],
],
],
]);

Using the Field Type
--------------------

Expand Down
6 changes: 6 additions & 0 deletionsreference/configuration/framework.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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 <forms-theming-twig>`.

Expand Down
5 changes: 5 additions & 0 deletionsreference/dic_tags.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
12 changes: 12 additions & 0 deletionstemplating/PHP.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand All@@ -17,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
Expand Down
12 changes: 9 additions & 3 deletionstemplating/hinclude.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ in your application configuration:
# config/packages/framework.yaml
framework:
# ...
templating:
fragments:
hinclude_default_template: hinclude.html.twig

.. code-block:: xml
Expand All@@ -83,7 +83,7 @@ in your application configuration:

<!-- ... -->
<framework:config>
<framework:templating hinclude-default-template="hinclude.html.twig"/>
<framework:fragments hinclude-default-template="hinclude.html.twig"/>
</framework:config>
</container>

Expand All@@ -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):

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp