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

Commitb265467

Browse files
committed
Merge branch 'form-label-attr-documentation' of github.com:dorians/symfony-docs into dorians-form-label-attr-documentation
Conflicts:reference/forms/types/choice.rstreference/forms/types/collection.rstreference/forms/types/country.rstreference/forms/types/currency.rstreference/forms/types/email.rstreference/forms/types/entity.rstreference/forms/types/integer.rstreference/forms/types/language.rstreference/forms/types/locale.rstreference/forms/types/money.rstreference/forms/types/number.rstreference/forms/types/percent.rstreference/forms/types/text.rstreference/forms/types/timezone.rstreference/forms/types/url.rst
2 parents63be099 +9068288 commitb265467

26 files changed

+98
-0
lines changed

‎reference/forms/types/button.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A simple, non-responsive button.
1515
| Options| - `attr`_|
1616
|| - `disabled`_|
1717
|| - `label`_|
18+
|| - `label_attr`_|
1819
|| - `translation_domain`_|
1920
+----------------------+----------------------------------------------------------------------+
2021
| Parent type| none|
@@ -31,4 +32,6 @@ Options
3132

3233
..include::/reference/forms/types/options/button_label.rst.inc
3334

35+
..include::/reference/forms/types/options/label_attr.rst.inc
36+
3437
..include::/reference/forms/types/options/button_translation_domain.rst.inc

‎reference/forms/types/checkbox.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if the box is unchecked, the value will be set to false.
1616
| Inherited| - `data`_|
1717
| options| - `required`_|
1818
|| - `label`_|
19+
|| - `label_attr`_|
1920
|| - `read_only`_|
2021
|| - `disabled`_|
2122
|| - `error_bubbling`_|
@@ -63,6 +64,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
6364

6465
..include::/reference/forms/types/options/label.rst.inc
6566

67+
..include::/reference/forms/types/options/label_attr.rst.inc
68+
6669
..include::/reference/forms/types/options/read_only.rst.inc
6770

6871
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/choice.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ option.
2222
+-------------+------------------------------------------------------------------------------+
2323
| Inherited| - `required`_|
2424
| options| - `label`_|
25+
|| - `label_attr`_|
2526
|| - `data`_|
2627
|| - `read_only`_|
2728
|| - `disabled`_|
@@ -117,6 +118,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
117118

118119
..include::/reference/forms/types/options/label.rst.inc
119120

121+
..include::/reference/forms/types/options/label_attr.rst.inc
122+
120123
..include::/reference/forms/types/options/data.rst.inc
121124

122125
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/collection.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ forms, which is useful when creating forms that expose one-to-many relationships
2121
|| - `prototype_name`_|
2222
+-------------+-----------------------------------------------------------------------------+
2323
| Inherited| - `label`_|
24+
|| - `label_attr`_|
2425
| options| - `error_bubbling`_|
2526
|| - `error_mapping`_|
2627
|| - `by_reference`_|
@@ -341,6 +342,8 @@ Not all options are listed here - only the most applicable to this type:
341342

342343
..include::/reference/forms/types/options/label.rst.inc
343344

345+
..include::/reference/forms/types/options/label_attr.rst.inc
346+
344347
error_bubbling
345348
~~~~~~~~~~~~~~
346349

‎reference/forms/types/country.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ you should just use the ``choice`` type directly.
3333
|| - `error_mapping`_|
3434
|| - `required`_|
3535
|| - `label`_|
36+
|| - `label_attr`_|
3637
|| - `data`_|
3738
|| - `read_only`_|
3839
|| - `disabled`_|
@@ -77,6 +78,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7778

7879
..include::/reference/forms/types/options/label.rst.inc
7980

81+
..include::/reference/forms/types/options/label_attr.rst.inc
82+
8083
..include::/reference/forms/types/options/data.rst.inc
8184

8285
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/currency.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ should just use the ``choice`` type directly.
2626
|| - `error_bubbling`_|
2727
|| - `required`_|
2828
|| - `label`_|
29+
|| - `label_attr`_|
2930
|| - `data`_|
3031
|| - `read_only`_|
3132
|| - `disabled`_|
@@ -67,6 +68,8 @@ These options inherit from the :doc:`form</reference/forms/types/form>` type:
6768

6869
..include::/reference/forms/types/options/label.rst.inc
6970

71+
..include::/reference/forms/types/options/label_attr.rst.inc
72+
7073
..include::/reference/forms/types/options/data.rst.inc
7174

7275
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/email.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The ``email`` field is a text field that is rendered using the HTML5
1313
| Inherited| - `max_length`_|
1414
| options| - `required`_|
1515
|| - `label`_|
16+
|| - `label_attr`_|
1617
|| - `data`_|
1718
|| - `trim`_|
1819
|| - `read_only`_|
@@ -37,6 +38,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
3738

3839
..include::/reference/forms/types/options/label.rst.inc
3940

41+
..include::/reference/forms/types/options/label_attr.rst.inc
42+
4043
..include::/reference/forms/types/options/data.rst.inc
4144

4245
..include::/reference/forms/types/options/trim.rst.inc

‎reference/forms/types/entity.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ objects from the database.
2727
|| - `empty_value`_|
2828
|| - `required`_|
2929
|| - `label`_|
30+
|| - `label_attr`_|
3031
|| - `data`_|
3132
|| - `read_only`_|
3233
|| - `disabled`_|
@@ -196,6 +197,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
196197

197198
..include::/reference/forms/types/options/label.rst.inc
198199

200+
..include::/reference/forms/types/options/label_attr.rst.inc
201+
199202
..include::/reference/forms/types/options/data.rst.inc
200203

201204
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/file.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The ``file`` type represents a file input in your form.
1111
+-------------+---------------------------------------------------------------------+
1212
| Inherited| - `required`_|
1313
| options| - `label`_|
14+
|| - `label_attr`_|
1415
|| - `read_only`_|
1516
|| - `disabled`_|
1617
|| - `error_bubbling`_|
@@ -85,6 +86,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
8586

8687
..include::/reference/forms/types/options/label.rst.inc
8788

89+
..include::/reference/forms/types/options/label_attr.rst.inc
90+
8891
..include::/reference/forms/types/options/read_only.rst.inc
8992

9093
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/form.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on all fields.
1515

1616
..include::/reference/forms/types/options/required.rst.inc
1717

18+
..include::/reference/forms/types/options/label.rst.inc
19+
20+
..include::/reference/forms/types/options/label_attr.rst.inc
21+
1822
..include::/reference/forms/types/options/constraints.rst.inc
1923

2024
..include::/reference/forms/types/options/cascade_validation.rst.inc

‎reference/forms/types/integer.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6
2121
+-------------+-----------------------------------------------------------------------+
2222
| Inherited| - `required`_|
2323
| options| - `label`_|
24+
|| - `label_attr`_|
2425
|| - `data`_|
2526
|| - `read_only`_|
2627
|| - `disabled`_|
@@ -72,6 +73,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7273

7374
..include::/reference/forms/types/options/label.rst.inc
7475

76+
..include::/reference/forms/types/options/label_attr.rst.inc
77+
7578
..include::/reference/forms/types/options/data.rst.inc
7679

7780
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/language.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ you should just use the ``choice`` type directly.
3434
|| - `error_mapping`_|
3535
|| - `required`_|
3636
|| - `label`_|
37+
|| - `label_attr`_|
3738
|| - `data`_|
3839
|| - `read_only`_|
3940
|| - `disabled`_|
@@ -78,6 +79,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7879

7980
..include::/reference/forms/types/options/label.rst.inc
8081

82+
..include::/reference/forms/types/options/label_attr.rst.inc
83+
8184
..include::/reference/forms/types/options/data.rst.inc
8285

8386
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/locale.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ you should just use the ``choice`` type directly.
3636
|| - `error_mapping`_|
3737
|| - `required`_|
3838
|| - `label`_|
39+
|| - `label_attr`_|
3940
|| - `data`_|
4041
|| - `read_only`_|
4142
|| - `disabled`_|
@@ -80,6 +81,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
8081

8182
..include::/reference/forms/types/options/label.rst.inc
8283

84+
..include::/reference/forms/types/options/label_attr.rst.inc
85+
8386
..include::/reference/forms/types/options/data.rst.inc
8487

8588
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/money.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ how the input and output of the data is handled.
2121
+-------------+---------------------------------------------------------------------+
2222
| Inherited| - `required`_|
2323
| options| - `label`_|
24+
|| - `label_attr`_|
2425
|| - `data`_|
2526
|| - `read_only`_|
2627
|| - `disabled`_|
@@ -90,6 +91,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
9091

9192
..include::/reference/forms/types/options/label.rst.inc
9293

94+
..include::/reference/forms/types/options/label_attr.rst.inc
95+
9396
..include::/reference/forms/types/options/data.rst.inc
9497

9598
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/number.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ you want to use for your number.
1717
+-------------+----------------------------------------------------------------------+
1818
| Inherited| - `required`_|
1919
| options| - `label`_|
20+
|| - `label_attr`_|
2021
|| - `data`_|
2122
|| - `read_only`_|
2223
|| - `disabled`_|
@@ -80,6 +81,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
8081

8182
..include::/reference/forms/types/options/label.rst.inc
8283

84+
..include::/reference/forms/types/options/label_attr.rst.inc
85+
8386
..include::/reference/forms/types/options/data.rst.inc
8487

8588
..include::/reference/forms/types/options/read_only.rst.inc
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
label_attr
2+
~~~~~
3+
4+
**type**: ``array`` **default**: ``array()``
5+
6+
Sets the html attributes for the ``<label>`` element, which will be used when
7+
rendering the label for the field. It's an associative array with HTML attribute
8+
as a key. This attributes can also be directly set inside the template:
9+
10+
.. configuration-block::
11+
12+
.. code-block:: jinja
13+
14+
{{ form_label(form.name, 'Your name', {'label_attr': {'class': 'CUSTOM_LABEL_CLASS'}}) }}
15+
16+
.. code-block:: php
17+
18+
echo $view['form']->label(
19+
$form['name'],
20+
'Your name',
21+
array('class', 'CUSTOM_LABEL_CLASS')
22+
);

‎reference/forms/types/password.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The ``password`` field renders an input password text box.
1414
| Inherited| - `max_length`_|
1515
| options| - `required`_|
1616
|| - `label`_|
17+
|| - `label_attr`_|
1718
|| - `trim`_|
1819
|| - `read_only`_|
1920
|| - `disabled`_|
@@ -52,6 +53,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
5253

5354
..include::/reference/forms/types/options/label.rst.inc
5455

56+
..include::/reference/forms/types/options/label_attr.rst.inc
57+
5558
..include::/reference/forms/types/options/trim.rst.inc
5659

5760
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/percent.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This field adds a percentage sign "``%``" after the input box.
2020
+-------------+-----------------------------------------------------------------------+
2121
| Inherited| - `required`_|
2222
| options| - `label`_|
23+
|| - `label_attr`_|
2324
|| - `data`_|
2425
|| - `read_only`_|
2526
|| - `disabled`_|
@@ -74,6 +75,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7475

7576
..include::/reference/forms/types/options/label.rst.inc
7677

78+
..include::/reference/forms/types/options/label_attr.rst.inc
79+
7780
..include::/reference/forms/types/options/data.rst.inc
7881

7982
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/radio.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
2020
| Inherited| - `data`_|
2121
| options| - `required`_|
2222
|| - `label`_|
23+
|| - `label_attr`_|
2324
|| - `read_only`_|
2425
|| - `disabled`_|
2526
|| - `error_bubbling`_|
@@ -57,6 +58,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
5758

5859
..include::/reference/forms/types/options/label.rst.inc
5960

61+
..include::/reference/forms/types/options/label_attr.rst.inc
62+
6063
..include::/reference/forms/types/options/read_only.rst.inc
6164

6265
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/reset.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A button that resets all fields to their original values.
1515
| Inherited| - `attr`_|
1616
| options| - `disabled`_|
1717
|| - `label`_|
18+
|| - `label_attr`_|
1819
|| - `translation_domain`_|
1920
+----------------------+---------------------------------------------------------------------+
2021
| Parent type|:doc:`button</reference/forms/types/button>`|
@@ -31,4 +32,6 @@ Inherited options
3132

3233
..include::/reference/forms/types/options/button_label.rst.inc
3334

35+
..include::/reference/forms/types/options/label_attr.rst.inc
36+
3437
..include::/reference/forms/types/options/button_translation_domain.rst.inc

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp