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

Commit4af71a0

Browse files
committed
minor#20757 Add Twigfield_id() form helper (alamirault)
This PR was merged into the 7.3 branch.Discussion----------Add Twig `field_id()` form helperFix#20725Commits-------b76b199 [TwigBridge] Add Twig field_id() form helper
2 parents409ec02 +b76b199 commit4af71a0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎form/form_customization.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ That's why Symfony provides other Twig form helpers that render the value of
103103
each form field part without adding any HTML around it:
104104

105105
* ``field_name()``
106+
* ``field_id()``
106107
* ``field_value()``
107108
* ``field_label()``
108109
* ``field_help()``
@@ -116,6 +117,7 @@ fields, so you no longer have to deal with form themes:
116117

117118
<input
118119
name="{{ field_name(form.username) }}"
120+
id="{{ field_id(form.username) }}"
119121
value="{{ field_value(form.username) }}"
120122
placeholder="{{ field_label(form.username) }}"
121123
class="form-control"
@@ -129,6 +131,10 @@ fields, so you no longer have to deal with form themes:
129131
{% endfor %}
130132
</select>
131133

134+
..versionadded::7.3
135+
136+
The ``field_id()`` helper was introduced in Symfony 7.3.
137+
132138
Form Rendering Variables
133139
------------------------
134140

‎reference/twig_reference.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ explained in the article about :doc:`customizing form rendering </form/form_cust
408408
*:ref:`form_row()<reference-forms-twig-row>`
409409
*:ref:`form_rest()<reference-forms-twig-rest>`
410410
*:ref:`field_name()<reference-forms-twig-field-helpers>`
411+
*:ref:`field_id()<reference-forms-twig-field-helpers>`
411412
*:ref:`field_value()<reference-forms-twig-field-helpers>`
412413
*:ref:`field_label()<reference-forms-twig-field-helpers>`
413414
*:ref:`field_help()<reference-forms-twig-field-helpers>`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp