@@ -11,74 +11,24 @@ class DateTimeWidget extends CoreDateTimeWidget
1111 use InputGroupTrait;
1212
1313 /**
14- * Render a select box form input.
15- *
16- * Render a select box input given a set of data. Supported keys
17- * are:
18- *
19- * - `name` - Set the input name.
20- * - `options` - An array of options.
21- * - `disabled` - Either true or an array of options to disable.
22- * When true, the select element will be disabled.
23- * - `val` - Either a string or an array of options to mark as selected.
24- * - `empty` - Set to true to add an empty option at the top of the
25- * option elements. Set to a string to define the display text of the
26- * empty option. If an array is used the key will set the value of the empty
27- * option while, the value will set the display text.
28- * - `escape` - Set to false to disable HTML escaping.
29- *
30- * ### Options format
31- *
32- * The options option can take a variety of data format depending on
33- * the complexity of HTML you want generated.
34- *
35- * You can generate simple options using a basic associative array:
36- *
37- * ```
38- * 'options' => ['elk' => 'Elk', 'beaver' => 'Beaver']
39- * ```
40- *
41- * If you need to define additional attributes on your option elements
42- * you can use the complex form for options:
43- *
44- * ```
45- * 'options' => [
46- * ['value' => 'elk', 'text' => 'Elk', 'data-foo' => 'bar'],
47- * ]
48- * ```
49- *
50- * This form **requires** that both the `value` and `text` keys be defined.
51- * If either is not set options will not be generated correctly.
52- *
53- * If you need to define option groups you can do those using nested arrays:
54- *
55- * ```
56- * 'options' => [
57- * 'Mammals' => [
58- * 'elk' => 'Elk',
59- * 'beaver' => 'Beaver'
60- * ]
61- * ]
62- * ```
63- *
64- * And finally, if you need to put attributes on your optgroup elements you
65- * can do that with a more complex nested array form:
66- *
67- * ```
68- * 'options' => [
69- * [
70- * 'text' => 'Mammals',
71- * 'data-id' => 1,
72- * 'options' => [
73- * 'elk' => 'Elk',
74- * 'beaver' => 'Beaver'
75- * ]
76- * ],
77- * ]
78- * ```
79- *
80- * You are free to mix each of the forms in the same option set, and
81- * nest complex types as required.
14+ * Render a date / time form widget.
15+ *
16+ * Data supports the following keys:
17+ *
18+ * - `name` The name attribute.
19+ * - `val` The value attribute.
20+ * - `escape` Set to false to disable escaping on all attributes.
21+ * - `type` A valid HTML date/time input type. Defaults to "datetime-local".
22+ * - `timezone` The timezone the input value should be converted to.
23+ * - `step` The "step" attribute. Defaults to `1` for "time" and "datetime-local" type inputs.
24+ * You can set it to `null` or `false` to prevent explicit step attribute being added in HTML.
25+ * - `format` A `date()` function compatible datetime format string.
26+ * By default, the widget will use a suitable format based on the input type and
27+ * database type for the context. If an explicit format is provided, then no
28+ * default value will be set for the `step` attribute, and it needs to be
29+ * explicitly set if required.
30+ *
31+ * All other keys will be converted into HTML attributes.
8232 *
8333 * @param array $data Data to render with.
8434 * @param \Cake\View\Form\ContextInterface $context The current form context.
0 commit comments