From ba626dc769bc32c99ea156bbbddb17700f401439 Mon Sep 17 00:00:00 2001 From: yositani2002 Date: Wed, 23 Apr 2014 07:56:48 +0900 Subject: [PATCH] resolved #291 --- reference/forms/types/birthday.rst | 121 +++++++++++------- reference/forms/types/date.rst | 170 ++++++++++++++++-------- reference/forms/types/datetime.rst | 173 ++++++++++++++++++------- reference/forms/types/time.rst | 199 ++++++++++++++++++++--------- 4 files changed, 456 insertions(+), 207 deletions(-) diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index d0c527c..e28abc2 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -1,68 +1,95 @@ .. index:: single: Forms; Fields; birthday -birthday Field Type -=================== - -A :doc:`date` field that specializes in handling -birthdate data. - -Can be rendered as a single text box, three text boxes (month, day, and year), -or three select boxes. - -This type is essentially the same as the :doc:`date` -type, but with a more appropriate default for the `years`_ option. The `years`_ -option defaults to 120 years ago to the current year. - -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` (see the :ref:`input option `) | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Options | - `years`_ | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Inherited | - `widget`_ | -| options | - `input`_ | -| | - `months`_ | -| | - `days`_ | -| | - `format`_ | -| | - `pattern`_ | -| | - `data_timezone`_ | -| | - `user_timezone`_ | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Parent type | :doc:`date` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ - -Field Options -------------- +.. note:: + + * 対象バージョン:2.3+ + * 翻訳更新日:2014/04/23 + +birthday フィールドタイプ +========================= + +:doc:`date ` フィールドは誕生日のデータを取り扱うことに特化しています。 + +1つのテキストボックス、または、3つ(年月日)のテキストボックス、または、3つのセレクトボックスとして表示されます。 + +このタイプは :doc:`date ` タイプと基本的に同じですが、より適切なデフォルトを `years`_ オプションにもちます。 +`years`_ オプションにはデフォルトで 120年前から今年まで(の選択肢が入ります)。 + ++------------------------+-------------------------------------------------------------------------------------------+ +| 対応するデータ型 | ``DateTime``, ``string``, ``timestamp``, ``array`` | +| | (参照 :ref:`input option `) | ++------------------------+-------------------------------------------------------------------------------------------+ +| 対応するタグ | `widget`_ オプションに基づいた3つのセレクトボックス、または、1つか3つのテキストボックス | ++------------------------+-------------------------------------------------------------------------------------------+ +| 上書きされたオプション | - `years`_ | ++------------------------+-------------------------------------------------------------------------------------------+ +| 継承されたオプション | - `widget`_ | +| | - `input`_ | +| | - `empty_value`_ | +| | - `months`_ | +| | - `days`_ | +| | - `format`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | +| | - `data`_ | +| | - `invalid_message`_ | +| | - `invalid_message_parameters`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `mapped`_ | +| | - `inherit_data`_ | ++------------------------+-------------------------------------------------------------------------------------------+ +| 親タイプ | :doc:`date ` | ++------------------------+-------------------------------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` | ++------------------------+-------------------------------------------------------------------------------------------+ + +上書きされたオプション +---------------------- years ~~~~~ -**type**: ``array`` **default**: 120 years ago to the current year +**データ型**: ``array`` **デフォルト**: 120年前から今年まで -List of years available to the year field type. This option is only -relevant when the ``widget`` option is set to ``choice``. +``year`` フィールドタイプで使用可能な年のリストです。このオプションは ``widget`` オプションが ``choice`` のときにのみ関連があります。 -Inherited options ------------------ +継承されたオプション +-------------------- -These options inherit from the :doc:`date` type: +以下のオプションは :doc:`date ` タイプを継承しています: .. include:: /reference/forms/types/options/date_widget.rst.inc - + .. include:: /reference/forms/types/options/date_input.rst.inc +.. include:: /reference/forms/types/options/empty_value.rst.inc + .. include:: /reference/forms/types/options/months.rst.inc .. include:: /reference/forms/types/options/days.rst.inc .. include:: /reference/forms/types/options/date_format.rst.inc - -.. include:: /reference/forms/types/options/date_pattern.rst.inc -.. include:: /reference/forms/types/options/data_timezone.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc + +.. include:: /reference/forms/types/options/view_timezone.rst.inc + +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/data.rst.inc + +.. include:: /reference/forms/types/options/invalid_message.rst.inc + +.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. include:: /reference/forms/types/options/inherit_data.rst.inc -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. 2014/04/23 yositani2002 d49d12eaf265a5d6d32ac660c62f385d57261475 diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index c48be5f..657bdfd 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -1,49 +1,62 @@ .. index:: single: Forms; Fields; date -date Field Type -=============== - -A field that allows the user to modify date information via a variety of -different HTML elements. - -The underlying data used for this field type can be a ``DateTime`` object, -a string, a timestamp or an array. As long as the `input`_ option is set -correctly, the field will take care of all of the details. - -The field can be rendered as a single text box, three text boxes (month, -day, and year) or three select boxes (see the `widget_` option). - -+----------------------+-----------------------------------------------------------------------------+ -| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) | -+----------------------+-----------------------------------------------------------------------------+ -| Rendered as | single text box or three select fields | -+----------------------+-----------------------------------------------------------------------------+ -| Options | - `widget`_ | -| | - `input`_ | -| | - `empty_value`_ | -| | - `years`_ | -| | - `months`_ | -| | - `days`_ | -| | - `format`_ | -| | - `pattern`_ | -| | - `data_timezone`_ | -| | - `user_timezone`_ | -+----------------------+-----------------------------------------------------------------------------+ -| Parent type | ``field`` (if text), ``form`` otherwise | -+----------------------+-----------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType` | -+----------------------+-----------------------------------------------------------------------------+ - -Basic Usage ------------ - +.. note:: + + * 対象バージョン:2.3+ + * 翻訳更新日:2014/04/23 + +date フィールドタイプ +===================== + +異なった様々な HTML 要素で日付情報を変更することができるフィールドです。 + +このフィールドタイプに使用される元となるデータは ``DateTime`` オブジェクト、 ``string`` 、 ``timestamp`` または ``array`` です。 +`input`_ オプションが正しく設定されている限り、フィールドはすべての詳細を引き受けます。 + +このフィールドは1つのテキストボックス、または、3つのテキストボックス(月、日、年)、または、3つのセレクトボックス(参照 `widget`_ オプション)として表示することができます。 + ++----------------------+-----------------------------------------------------------------------------------------+ +| 対応するデータ型 | ``DateTime``,``string``, ``timestamp``, ``array`` (参照 ``input`` オプション) | ++----------------------+-----------------------------------------------------------------------------------------+ +| 対応するタグ | 単一のテキストボックス または、 3つのセレクトフィールド | ++----------------------+-----------------------------------------------------------------------------------------+ +| オプション | - `widget`_ | +| | - `input`_ | +| | - `empty_value`_ | +| | - `years`_ | +| | - `months`_ | +| | - `days`_ | +| | - `format`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | ++----------------------+-----------------------------------------------------------------------------------------+ +| 上書きされた | - `by_reference`_ | +| オプション | - `error_bubbling`_ | ++----------------------+-----------------------------------------------------------------------------------------+ +| 継承された | - `data`_ | +| オプション | - `invalid_message`_ | +| | - `invalid_message_parameters`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `mapped`_ | +| | - `inherit_data`_ | +| | - `error_mapping`_ | ++----------------------+-----------------------------------------------------------------------------------------+ +| 親タイプ | :doc:`form ` | ++----------------------+-----------------------------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType` | ++----------------------+-----------------------------------------------------------------------------------------+ + +基本的な使い方 +-------------- + +このフィールドタイプは高度に設定が可能でありながら、簡単に使えます。最も重要なオプションは ``input`` と ``widget`` です。 This field type is highly configurable, but easy to use. The most important options are ``input`` and ``widget``. -Suppose that you have a ``publishedAt`` field whose underlying date is a -``DateTime`` object. The following configures the ``date`` type for that -field as three different choice fields: +``publishedAt`` フィールドに``DateTime`` オブジェクトの日付データを持つとします。 +以下は、``date`` タイプを3つの選択フィールドとして設定します。: .. code-block:: php @@ -52,9 +65,8 @@ field as three different choice fields: 'widget' => 'choice', )); -The ``input`` option *must* be changed to match the type of the underlying -date data. For example, if the ``publishedAt`` field's data were a unix timestamp, -you'd need to set ``input`` to ``timestamp``: +この ``input`` オプションは元となる日付データと同じタイプに変換され *なくてはいけません* 。 +例えば、 ``publishedAt`` フィールドデータが Unix タイムスタンプの場合、``input`` に ``timestamp`` を設定しないといけません。: .. code-block:: php @@ -63,11 +75,12 @@ you'd need to set ``input`` to ``timestamp``: 'widget' => 'choice', )); +フィールドは ``array`` と ``string`` を正しい ``input`` オプションの値としてサポートします。 The field also supports an ``array`` and ``string`` as valid ``input`` option values. -Field Options -------------- +フィールドオプション +-------------------- .. include:: /reference/forms/types/options/date_widget.rst.inc @@ -78,17 +91,16 @@ Field Options empty_value ~~~~~~~~~~~ -**type**: ``string``|``array`` +**データ型**: ``string`` または ``array`` -If your widget option is set to ``choice``, then this field will be represented -as a series of ``select`` boxes. The ``empty_value`` option can be used to -add a "blank" entry to the top of each select box:: +もし、ウィジェットのオプションが ``choice`` がセットされていた場合、一連のセレクトボックスとして表現されます。 +``empty_value`` オプションは"空"エントリーを各セレクトボックスの一番上に追加できます。:: $builder->add('dueDate', 'date', array( 'empty_value' => '', )); -Alternatively, you can specify a string to be displayed for the "blank" value:: +別の方法として、"空"の値として特定の文字を指定することが出来ます。:: $builder->add('dueDate', 'date', array( 'empty_value' => array('year' => 'Year', 'month' => 'Month', 'day' => 'Day') @@ -100,10 +112,62 @@ Alternatively, you can specify a string to be displayed for the "blank" value:: .. include:: /reference/forms/types/options/days.rst.inc +.. _reference-forms-type-date-format: + .. include:: /reference/forms/types/options/date_format.rst.inc -.. include:: /reference/forms/types/options/date_pattern.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc + +.. include:: /reference/forms/types/options/view_timezone.rst.inc + +上書きされたオプション +---------------------- + +by_reference +~~~~~~~~~~~~ + +**デフォルト**: ``false`` + +``DateTime`` クラスは不変のオブジェクトとして扱われます。 + +error_bubbling +~~~~~~~~~~~~~~ + +**デフォルト**: ``false`` + +継承されたオプション +-------------------- + +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/data.rst.inc + +.. include:: /reference/forms/types/options/invalid_message.rst.inc + +.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. include:: /reference/forms/types/options/inherit_data.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +フィールド変数 +-------------- -.. include:: /reference/forms/types/options/data_timezone.rst.inc ++--------------+------------+---------------------------------------------------------------------------------+ +| 変数 | データ型 | 使用法 | ++==============+============+=================================================================================+ +| widget | ``mixed`` | `widget`_ オプションの値。 | ++--------------+------------+---------------------------------------------------------------------------------+ +| type | ``string`` | ``widget`` が ``single_text`` で、且つ、 HTML5 が有効な場合のみ、 | +| | | インプットタイプ(``datetime``, ``date`` または ``time`` )を使用できます。 | ++--------------+------------+---------------------------------------------------------------------------------+ +| date_pattern | ``string`` | 日付フォーマットの文字列 | ++--------------+------------+---------------------------------------------------------------------------------+ -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. 2014/04/23 yositani200 d49d12eaf265a5d6d32ac660c62f385d57261475 diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index b3fa955..26fdab2 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -1,72 +1,113 @@ .. index:: single: Forms; Fields; datetime -datetime Field Type -=================== - -This field type allows the user to modify data that represents a specific -date and time (e.g. ``1984-06-05 12:15:30``). - -Can be rendered as a text input or select tags. The underlying format of the -data can be a ``DateTime`` object, a string, a timestamp or an array. - -+----------------------+-----------------------------------------------------------------------------+ -| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) | -+----------------------+-----------------------------------------------------------------------------+ -| Rendered as | single text box or three select fields | -+----------------------+-----------------------------------------------------------------------------+ -| Options | - `date_widget`_ | -| | - `time_widget`_ | -| | - `input`_ | -| | - `date_format`_ | -| | - `years`_ | -| | - `months`_ | -| | - `days`_ | -+----------------------+-----------------------------------------------------------------------------+ -| Parent type | :doc:`form` | -+----------------------+-----------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` | -+----------------------+-----------------------------------------------------------------------------+ - -Field Options -------------- +.. note:: + + * 対象バージョン:2.3+ + * 翻訳更新日:2014/04/23 + +datetime フィールドタイプ +========================= + +このフィールドタイプは、特定の日付と時間(例 ``1984-06-05 12:15:30`` )を表すデータを変更することができます。 + +テキスト入力またはセレクトタグとして表示されます。 +元となるデータのフォーマットは ``DateTime`` オブジェクト、 ``string`` 、 ``timestamp`` または ``array`` です。 + ++----------------------+------------------------------------------------------------------------------------------+ +| 対応するデータ型 | ``DateTime``, ``string``, ``timestamp``, ``array`` (参照``input`` オプション ) | ++----------------------+------------------------------------------------------------------------------------------+ +| 対応するタグ | 単一のテキストボックス、または、3つのセレクトフィールド | ++----------------------+------------------------------------------------------------------------------------------+ +| オプション | - `date_widget`_ | +| | - `time_widget`_ | +| | - `widget`_ | +| | - `input`_ | +| | - `date_format`_ | +| | - `format`_ | +| | - `hours`_ | +| | - `minutes`_ | +| | - `seconds`_ | +| | - `years`_ | +| | - `months`_ | +| | - `days`_ | +| | - `with_minutes`_ | +| | - `with_seconds`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | +| | - `empty_value`_ | ++----------------------+------------------------------------------------------------------------------------------+ +| 継承された | - `data`_ | +| オプション | - `invalid_message`_ | +| | - `invalid_message_parameters`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `mapped`_ | +| | - `inherit_data`_ | ++----------------------+------------------------------------------------------------------------------------------+ +| 親タイプ | :doc:`form ` | ++----------------------+------------------------------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` | ++----------------------+------------------------------------------------------------------------------------------+ + +フィールドオプション +-------------------- date_widget ~~~~~~~~~~~ -**type**: ``string`` **default**: ``choice`` +**データ型**: ``string`` **デフォルト**: ``choice`` -Defines the ``widget`` option for the :doc:`date` type +:doc:`date ` タイプの ``widget`` オプションを定義します。 time_widget ~~~~~~~~~~~ -**type**: ``string`` **default**: ``choice`` +**データ型**: ``string`` **デフォルト**: ``choice`` -Defines the ``widget`` option for the :doc:`time` type +:doc:`time ` タイプの ``widget`` オプションを定義します。 + +widget +~~~~~~ + +**データ型**: ``string`` **デフォルト**: ``null`` + +:doc:`date ` タイプと、:doc:`time ` タイプの ``widget`` オプションを両方定義します。 +これは `date_widget`_ と `time_widget`_ オプションを上書きすることが出来ます。 input ~~~~~ -**type**: ``string`` **default**: ``datetime`` +**データ型**: ``string`` **デフォルト**: ``datetime`` -The format of the *input* data - i.e. the format that the date is stored on -your underlying object. Valid values are: +*input* データのフォーマット、すなわち、対応するオブジェクトに保存される日付のフォーマットの有効な値は次のとおりです。: -* ``string`` (e.g. ``2011-06-05 12:15:00``) -* ``datetime`` (a ``DateTime`` object) -* ``array`` (e.g. ``array(2011, 06, 05, 12, 15, 0)``) -* ``timestamp`` (e.g. ``1307276100``) +* ``string`` (例 ``2011-06-05 12:15:00``) +* ``datetime`` (単一の ``DateTime`` オブジェクト) +* ``array`` (例 ``array(2011, 06, 05, 12, 15, 0)``) +* ``timestamp`` (例 ``1307276100``) -The value that comes back from the form will also be normalized back into -this format. +フォームから戻って来る値も、この形式に戻して正規化されます。 + +.. include:: /reference/forms/types/options/_date_limitation.rst.inc date_format ~~~~~~~~~~~ -**type**: ``integer`` or ``string`` **default**: ``IntlDateFormatter::MEDIUM`` +**データ型**: ``integer`` or ``string`` **デフォルト**: ``IntlDateFormatter::MEDIUM`` + +``format`` オプションの定義は ``date`` フィールドに渡されます。 +より詳細は ::ref:`date type's format option ` を参照してください。 + +format +~~~~~~ -Defines the ``format`` option that will be passed down to the date field. +**データ型**: ``string`` **デフォルト**: ``Symfony\Component\Form\Extension\Core\Type\DateTimeType::HTML5_FORMAT`` + +``widget`` オプションを ``single_text`` にセットした場合、このオプションは入力フォーマットを特定します。 +すなわち、 Symfony が入力を日時文字列としてどのように解釈するかを指定します。 +デフォルトでは `RFC3339`_ フォーマットが HTML5の ``datetime`` フィールドに利用されます。 +デフォルト値を維持することでフィールドが ``type="datetime"`` 付の ``input`` フィールドとしてレンダリングされます。 .. include:: /reference/forms/types/options/hours.rst.inc @@ -80,8 +121,48 @@ Defines the ``format`` option that will be passed down to the date field. .. include:: /reference/forms/types/options/days.rst.inc +.. include:: /reference/forms/types/options/with_minutes.rst.inc + .. include:: /reference/forms/types/options/with_seconds.rst.inc -.. include:: /reference/forms/types/options/data_timezone.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc + +.. include:: /reference/forms/types/options/view_timezone.rst.inc + +.. include:: /reference/forms/types/options/empty_value.rst.inc + +継承されたオプション +-------------------- + +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/data.rst.inc + +.. include:: /reference/forms/types/options/invalid_message.rst.inc + +.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. include:: /reference/forms/types/options/inherit_data.rst.inc + +フィールド変数 +-------------- + ++----------+------------+---------------------------------------------------------------------------------------+ +| 変数 | データ型 | 使用法 | ++==========+============+=======================================================================================+ +| widget | ``mixed`` | `widget`_ オプションの値 | ++----------+------------+---------------------------------------------------------------------------------------+ +| type | ``string`` | `widget`` が ``single_text`` で、且つ、 HTML5 が有効な場合のみ、 | +| | | インプットタイプ( ``datetime``, ``date`` または ``time`` )を使用できます。 | ++----------+------------+---------------------------------------------------------------------------------------+ + + +.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339 -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. 2014/04/23 yositani2002 d49d12eaf265a5d6d32ac660c62f385d57261475 diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 3858a34..fd9e159 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -1,43 +1,59 @@ .. index:: single: Forms; Fields; time -time Field Type -=============== - -A field to capture time input. - -This can be rendered as a text field, a series of text fields (e.g. hour, -minute, second) or a series of select fields. The underlying data can be stored -as a ``DateTime`` object, a string, a timestamp or an array. - -+----------------------+-----------------------------------------------------------------------------+ -| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) | -+----------------------+-----------------------------------------------------------------------------+ -| Rendered as | can be various tags (see below) | -+----------------------+-----------------------------------------------------------------------------+ -| Options | - `widget`_ | -| | - `input`_ | -| | - `with_seconds`_ | -| | - `hours`_ | -| | - `minutes`_ | -| | - `seconds`_ | -| | - `data_timezone`_ | -| | - `user_timezone`_ | -+----------------------+-----------------------------------------------------------------------------+ -| Parent type | form | -+----------------------+-----------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType` | -+----------------------+-----------------------------------------------------------------------------+ - -Basic Usage ------------ - -This field type is highly configurable, but easy to use. The most important -options are ``input`` and ``widget``. - -Suppose that you have a ``startTime`` field whose underlying time data is a -``DateTime`` object. The following configures the ``time`` type for that -field as three different choice fields: +.. note:: + + * 対象バージョン:2.3+ + * 翻訳更新日:2014/04/23 + +time フィールドタイプ +===================== + +時刻入力をするフィールドです。 + +これは1つのテキストフィールド、または、3つのテキストフィールド(例 時、分、秒)、または、一連のセレクトフィールドとして表示することができます。 +元となるデータは ``DateTime`` オブジェクト、 ``string`` 、 ``timestamp`` または ``array`` として保存することが出来ます。 + ++----------------------+--------------------------------------------------------------------------------+ +| 対応するデータ型 | ``DateTime``, ``string``, ``timestamp``, ``array`` (参照``input`` オプション ) | ++----------------------+--------------------------------------------------------------------------------+ +| 対応するタグ | 様々なタグとして利用可能 (下記参照) | ++----------------------+--------------------------------------------------------------------------------+ +| オプション | - `widget`_ | +| | - `input`_ | +| | - `with_minutes`_ | +| | - `with_seconds`_ | +| | - `hours`_ | +| | - `minutes`_ | +| | - `seconds`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | +| | - `empty_value`_ | ++----------------------+--------------------------------------------------------------------------------+ +| 上書きされた | - `by_reference`_ | +| オプション | - `error_bubbling`_ | ++----------------------+--------------------------------------------------------------------------------+ +| 継承された | - `invalid_message`_ | +| オプション | - `invalid_message_parameters`_ | +| | - `data`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `mapped`_ | +| | - `inherit_data`_ | +| | - `error_mapping`_ | ++----------------------+--------------------------------------------------------------------------------+ +| 親タイプ | form | ++----------------------+--------------------------------------------------------------------------------+ +| クラス | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType` | ++----------------------+--------------------------------------------------------------------------------+ + +基本的な使い方 +-------------- + +このフィールドタイプは高度に設定が可能でありながら、簡単に使えます。最も重要なオプションは ``input`` と ``widget`` です。 + +``startTime`` フィールドに ``DateTime`` オブジェクトの時間データを持つとします。 +以下は、``time`` タイプを2つの異なった選択フィールドとして設定します。: .. code-block:: php @@ -46,9 +62,8 @@ field as three different choice fields: 'widget' => 'choice', )); -The ``input`` option *must* be changed to match the type of the underlying -date data. For example, if the ``startTime`` field's data were a unix timestamp, -you'd need to set ``input`` to ``timestamp``: +この ``input`` オプションは元となる時間データと同じタイプに変換され *なくてはいけません* 。 +例えば、 ``startTime`` フィールドデータが Unix タイムスタンプの場合、``input`` に ``timestamp`` を設定しないといけません。: .. code-block:: php @@ -57,41 +72,46 @@ you'd need to set ``input`` to ``timestamp``: 'widget' => 'choice', )); -The field also supports an ``array`` and ``string`` as valid ``input`` option -values. +フィールドは ``array`` と ``string`` を正しい ``input`` オプションの値としてサポートします。 -Field Options -------------- +フィールドオプション +-------------------- widget ~~~~~~ -**type**: ``string`` **default**: ``choice`` +**データ型**: ``string`` **デフォルト**: ``choice`` -The basic way in which this field should be rendered. Can be one of the following: +このフィールドがレンダリングされるべき基本的な方法は次のいずれかになります。: -* ``choice``: renders two (or three if `with_seconds`_ is true) select inputs. +* ``choice``: `with_minutes`_ と `with_seconds`_ オプションに基づいて、1つ、または、2つ(デフォルト)または3つのセレクト入力( ``hour`` , ``minute`` , ``second`` )を表示します。 -* ``text``: renders a two or three text inputs (hour, minute, second). +* ``text``: `with_minutes`_ と `with_seconds`_ オプションに基づいて、1つ、または、2つ(デフォルト)または3つのテキスト入力( ``hour`` , ``minute`` , ``second`` )を表示します。 -* ``single_text``: renders a single input of type text. User's input will - be validated against the form ``hh:mm`` (or ``hh:mm:ss`` if using seconds). +* ``single_text``: 単一の ``time`` タイプの入力フォームを表示します。ユーザーの入力は ``hh:mm`` (または ``HH:MM:SS`` 秒を使用している場合) のフォームに対して検証されます。 + +.. caution:: + + ウィジェットタイプの ``single_text`` と `with_minutes`_ オプションを ``false`` とする組み合わせは、 + 入力タイプ ``time`` が時間のみ選択することをサポートしていない可能性があり、 + クライアントで予期しない動作を引き起こす可能性があります。 input ~~~~~ -**type**: ``string`` **default**: ``datetime`` +**データ型**: ``string`` **デフォルト**: ``datetime`` + +*input* データのフォーマット、すなわち、対応するオブジェクトに保存される日付のフォーマットの +有効な値は次のとおりです。: -The format of the *input* data - i.e. the format that the date is stored on -your underlying object. Valid values are: +* ``string`` (例 ``12:17:26``) +* ``datetime`` (単一の ``DateTime`` オブジェクト) +* ``array`` (例 ``array('hour' => 12, 'minute' => 17, 'second' => 26)``) +* ``timestamp`` (例 ``1307232000``) -* ``string`` (e.g. ``12:17:26``) -* ``datetime`` (a ``DateTime`` object) -* ``array`` (e.g. ``array('hour' => 12, 'minute' => 17, 'second' => 26)``) -* ``timestamp`` (e.g. ``1307232000``) +フォームから戻って来る値も、この形式に戻して正規化されます。 -The value that comes back from the form will also be normalized back into -this format. +.. include:: /reference/forms/types/options/with_minutes.rst.inc .. include:: /reference/forms/types/options/with_seconds.rst.inc @@ -101,6 +121,63 @@ this format. .. include:: /reference/forms/types/options/seconds.rst.inc -.. include:: /reference/forms/types/options/data_timezone.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc + +.. include:: /reference/forms/types/options/view_timezone.rst.inc + +.. include:: /reference/forms/types/options/empty_value.rst.inc + +上書きされたオプション +---------------------- + +by_reference +~~~~~~~~~~~~ + +**デフォルト**: ``false`` + +``DateTime`` クラスは不変のオブジェクトとして扱われます。 + +error_bubbling +~~~~~~~~~~~~~~ + +**デフォルト**: ``false`` + +継承されたオプション +---------- + +以下のオプションは :doc:`form ` タイプを継承しています: + +.. include:: /reference/forms/types/options/invalid_message.rst.inc + +.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc + +.. include:: /reference/forms/types/options/data.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. include:: /reference/forms/types/options/inherit_data.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +フォーム変数 +------------ + ++--------------+-------------+---------------------------------------------------------------------------+ +| 変数 | データ型 | 使用法 | ++==============+=============+===========================================================================+ +| widget | ``mixed`` | `widget`_ オプションの値。 | ++--------------+-------------+---------------------------------------------------------------------------+ +| with_minutes | ``Boolean`` | `with_minutes`_ オプションの値。 | ++--------------+-------------+---------------------------------------------------------------------------+ +| with_seconds | ``Boolean`` | `with_seconds`_ オプションの値。 | ++--------------+-------------+---------------------------------------------------------------------------+ +| type | ``string`` | ``widget`` が ``single_text`` で、且つ、 HTML5 が有効な場合のみ、 | +| | | インプットタイプ(``datetime``, ``date`` または ``time`` )を使用できます。 | ++--------------+-------------+---------------------------------------------------------------------------+ + -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. 2014/04/23 yositani2002 d49d12eaf265a5d6d32ac660c62f385d57261475