Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add separate placeholder examples for birthday, datetime and time type #6206

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
26 changes: 25 additions & 1 deletion reference/forms/types/birthday.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,31 @@ type:

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

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('birthdate', 'birthday', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the year, month and day fields::

$builder->add('birthdate', 'birthday', array(
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
)
));

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

Expand Down
15 changes: 9 additions & 6 deletions reference/forms/types/date.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,23 @@ placeholder
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` or ``array``
**type**: ``string`` | ``array``

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

$builder->add('dueDate', 'date', array(
'placeholder' => '',
'placeholder' => 'Select a value',
));

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

$builder->add('dueDate', 'date', array(
'placeholder' => array('year' => 'Year', 'month' => 'Month', 'day' => 'Day')
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day'
)
));

.. _reference-forms-type-date-format:
Expand Down
27 changes: 26 additions & 1 deletion reference/forms/types/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,32 @@ date_widget

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

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('startDateTime', 'datetime', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the year, month, day, hour, minute and second fields::

$builder->add('startDateTime', 'datetime', array(
'placeholder' => array(
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
)
));

format
~~~~~~
Expand Down
26 changes: 25 additions & 1 deletion reference/forms/types/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,31 @@ values.
Field Options
-------------

.. include:: /reference/forms/types/options/placeholder.rst.inc
placeholder
~~~~~~~~~~~

.. versionadded:: 2.6
The ``placeholder`` option was introduced in Symfony 2.6 and replaces
``empty_value``, which is available prior to 2.6.

**type**: ``string`` | ``array``

If your widget option is set to ``choice``, then this field will be represented
as a series of ``select`` boxes. When the placeholder value is a string,
it will be used as the **blank value** of all select boxes::

$builder->add('startTime', 'time', array(
'placeholder' => 'Select a value',
));

Alternatively, you can use an array that configures different placeholder
values for the hour, minute and second fields::

$builder->add('startTime', 'time', array(
'placeholder' => array(
'hour' => 'Hour', 'minute' => 'Minute', 'second' => 'Second',
)
));

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

Expand Down