Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Syntax fixes
  • Loading branch information
javiereguiluz committed Jan 28, 2026
commit 6e6213266660fba5b231afb49bff90decdf22c87
2 changes: 1 addition & 1 deletion form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Twig Form Variables

Each field has a ``vars`` property containing all its rendering data:

.. code-block:: twig
.. code-block:: html+twig

<label for="{{ form.email.vars.id }}"
class="{{ form.email.vars.required ? 'required' }}">
Expand Down
24 changes: 10 additions & 14 deletions form/form_themes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@

**Overriding the field name in blocks:**

Use the ``block_name`` option to change the field name used in the block:

.. code-block:: php
Use the ``block_name`` option to change the field name used in the block::

$builder->add('name', TextType::class, [
'block_name' => 'custom_name',
Expand All @@ -349,9 +347,7 @@

Sometimes you need different rendering for the same field type in different
contexts. Use the ``block_prefix`` option to skip the default block naming rules
and assign a custom name for the field block:

.. code-block:: php
and assign a custom name for the field block::

$builder->add('biography', TextareaType::class, [
'block_prefix' => 'book_author',
Expand Down Expand Up @@ -458,7 +454,7 @@

Create a Twig template with the blocks you want to customize:

.. code-block:: twig
.. code-block:: html+twig

{# templates/form/theme.html.twig #}
{% use 'form_div_layout.html.twig' %}
Expand All @@ -480,11 +476,11 @@
override only what you need. Using ``parent()`` inside a block calls the
original implementation:

.. code-block:: twig
.. code-block:: html+twig

{% block text_widget %}
<div class="input-wrapper">
{{ parent() }}

Check failure on line 483 in form/form_themes.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Twig] Calling the "parent" function on a template that does not call "extends" or "use" is forbidden.
</div>
{% endblock %}

Expand All @@ -493,7 +489,7 @@

For customizations specific to one page, define blocks in the same template:

.. code-block:: twig
.. code-block:: html+twig

{# templates/user/registration.html.twig #}
{% extends 'base.html.twig' %}
Expand All @@ -519,7 +515,7 @@
When you need to call the original block implementation, use ``{% use %}`` with
block renaming:

.. code-block:: twig
.. code-block:: html+twig

{% form_theme form _self %}
{% use 'form_div_layout.html.twig' with text_widget as base_text_widget %}
Expand All @@ -542,7 +538,7 @@

Wrap every field in a custom container:

.. code-block:: twig
.. code-block:: html+twig

{# templates/form/theme.html.twig #}
{% use 'form_div_layout.html.twig' %}
Expand All @@ -563,7 +559,7 @@

Add an icon before or after input widgets:

.. code-block:: twig
.. code-block:: html+twig

{# templates/form/theme.html.twig #}
{% use 'form_div_layout.html.twig' %}
Expand All @@ -587,7 +583,7 @@

Display errors as a styled alert box:

.. code-block:: twig
.. code-block:: html+twig

{# templates/form/theme.html.twig #}
{% use 'form_div_layout.html.twig' %}
Expand Down Expand Up @@ -621,7 +617,7 @@

Display an asterisk next to required field labels:

.. code-block:: twig
.. code-block:: html+twig

{# templates/form/theme.html.twig #}
{% use 'form_div_layout.html.twig' %}
Expand Down
Loading