8000 add separate placeholder examples for birthday, datetime and time type · symfony/symfony-docs@70852c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70852c8

Browse files
Henry Snoekxabbuh
Henry Snoek
authored andcommitted
add separate placeholder examples for birthday, datetime and time type
1 parent 52cd29b commit 70852c8

File tree

4 files changed

+85
-9
lines changed

4 files changed

+85
-9
lines changed

reference/forms/types/birthday.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,31 @@ type:
6767

6868
.. include:: /reference/forms/types/options/days.rst.inc
6969

70-
.. include:: /reference/forms/types/options/placeholder.rst.inc
70+
placeholder
71+
~~~~~~~~~~~
72+
73+
.. versionadded:: 2.6
74+
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
75+
``empty_value``, which is available prior to 2.6.
76+
77+
**type**: ``string`` | ``array``
78+
79+
If your widget option is set to ``choice``, then this field will be represented
80+
as a series of ``select`` boxes. When the placeholder value is a string,
81+
it will be used as the **blank value** of all select boxes::
82+
83+
$builder->add('birthdate', 'birthday', array(
84+
'placeholder' => 'Select a value',
85+
));
86+
87+
Alternatively, you can use an array that configures different placeholder
88+
values for the year, month and day fields::
89+
90+
$builder->add('birthdate', 'birthday', array(
91+
'placeholder' => array(
92+
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
93+
)
94+
));
7195

7296
.. include:: /reference/forms/types/options/date_format.rst.inc
7397

reference/forms/types/date.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,23 @@ placeholder
8888
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
8989
``empty_value``, which is available prior to 2.6.
9090

91-
**type**: ``string`` or ``array``
91+
**type**: ``string`` | ``array``
9292

9393
If your widget option is set to ``choice``, then this field will be represented
94-
as a series of ``select`` boxes. The ``placeholder`` option can be used
95-
to add a "blank" entry to the top of each select box::
94+
as a series of ``select`` boxes. When the placeholder value is a string,
95+
it will be used as the **blank value** of all select boxes::
9696

9797
$builder->add('dueDate', 'date', array(
98-
'placeholder' => '',
98+
'placeholder' => 'Select a value',
9999
));
100100

101-
Alternatively, you can specify a string to be displayed for the "blank" value::
101+
Alternatively, you can use an array that configures different placeholder
102+
values for the year, month and day fields::
102103

103104
$builder->add('dueDate', 'date', array(
104-
'placeholder' => array('year' => 'Year', 'month' => 'Month', 'day' => 'Day')
105+
'placeholder' => array(
106+
'year' => 'Year', 'month' => 'Month', 'day' => 'Day'
107+
)
105108
));
106109

107110
.. _reference-forms-type-date-format:

reference/forms/types/datetime.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,32 @@ date_widget
7171

7272
.. include:: /reference/forms/types/options/days.rst.inc
7373

74-
.. include:: /reference/forms/types/options/placeholder.rst.inc
74+
placeholder
75+
~~~~~~~~~~~
76+
77+
.. versionadded:: 2.6
78+
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
79+
``empty_value``, which is available prior to 2.6.
80+
81+
**type**: ``string`` | ``array``
82+
83+
If your widget option is set to ``choice``, then this field will be represented
84+
as a series of ``select`` boxes. When the placeholder value is a string,
85+
it will be used as the **blank value** of all select boxes::
86+
87+
$builder->add('startDateTime', 'datetime', array(
88+
'placeholder' => 'Select a value',
89+
));
90+
91+
Alternatively, you can use an array that configures different placeholder
92+
values for the year, month, day, hour, minute and second fields::
93+
94+
$builder->add('startDateTime', 'datetime', array(
95+
'placeholder' => array(
96+
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
97+
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
98+
)
99+
));
75100

76101
format
77102
~~~~~~

reference/forms/types/time.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,31 @@ values.
7676
Field Options
7777
-------------
7878

79-
.. include:: /reference/forms/types/options/placeholder.rst.inc
79+
placeholder
80+
~~~~~~~~~~~
81+
82+
.. versionadded:: 2.6
83+
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
84+
``empty_value``, which is available prior to 2.6.
85+
86+
**type**: ``string`` | ``array``
87+
88+
If your widget option is set to ``choice``, then this field will be represented
89+
as a series of ``select`` boxes. When the placeholder value is a string,
90+
it will be used as the **blank value** of all select boxes::
91+
92+
$builder->add('startTime', 'time', array(
93+
'placeholder' => 'Select a value',
94+
));
95+
96+
Alternatively, you can use an array that configures different placeholder
97+
values for the hour, minute and second fields::
98+
99+
$builder->add('startTime', 'time', array(
100+
'placeholder' => array(
101+
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
102+
)
103+
));
80104

81105
.. include:: /reference/forms/types/options/hours.rst.inc
82106

0 commit comments

Comments
 (0)
0