Input widget class for generating a date time input widget.
This class is intended as an internal implementation detail of Cake\View\Helper\FormHelper and is not intended for direct use.
$_select protected $_selects protected array$_templates protected __construct( Cake\View\StringTemplate $templates , Cake\View\Widget\SelectBoxWidget $selectBox )
Constructor
Cake\View\StringTemplate $templates Cake\View\Widget\SelectBoxWidget $selectBox _adjustValue( integer $value , array $options )
Adjust $value based on rounding settings.
$value $options _daySelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a day select
$options Cake\View\Form\ContextInterface $context _deconstructDate( string|integer|array|DateTime|null $value , array $options )
Deconstructs the passed date value into all time units
$value $options _generateNumbers( integer $start , integer $end , array $options = [] )
Generates a range of numbers
$start $end $options optional [] _getMonthNames( boolean $leadingZero = false )
Returns a translated list of month names
$leadingZero optional false _hourSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a hour select
$options Cake\View\Form\ContextInterface $context _meridianSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a meridian select
$options Cake\View\Form\ContextInterface $context _minuteSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a minute select
$options Cake\View\Form\ContextInterface $context _monthSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a month select
$options Cake\View\Form\ContextInterface $context _normalizeData( array $data )
Normalize data.
$data _secondSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a second select
$options Cake\View\Form\ContextInterface $context _yearSelect( array $options , Cake\View\Form\ContextInterface $context )
Generates a year select
$options Cake\View\Form\ContextInterface $context render( array $data , Cake\View\Form\ContextInterface $context )
Renders a date time widget
name - Set the input name.disabled - Either true or an array of options to disable.val - A date time string, integer or DateTime objectempty - Set to true to add an empty option at the top of the option elements. Set to a string to define the display value of the empty option.In addition to the above options, the following options allow you to control which input elements are generated. By setting any option to false you can disable that input picker. In addition each picker allows you to set additional options that are set as HTML properties on the picker.
year - Array of options for the year select box.month - Array of options for the month select box.day - Array of options for the day select box.hour - Array of options for the hour select box.minute - Array of options for the minute select box.second - Set to true to enable the seconds input. Defaults to false.meridian - Set to true to enable the meridian input. Defaults to false. The meridian will be enabled automatically if you choose a 12 hour format.The year option accepts the start and end options. These let you control the year range that is generated. It defaults to +-5 years from today.
The month option accepts the name option which allows you to get month names instead of month numbers.
The hour option allows you to set the following options:
format option which accepts 12 or 24, allowing you to indicate which hour format you want.start The hour to start the options at.end The hour to stop the options at.The start and end options are dependent on the format used. If the value is out of the start/end range it will not be included.
The minute option allows you to define the following options:
interval The interval to round options to.round Accepts up or down. Defines which direction the current value should be rounded to match the select options.$data Cake\View\Form\ContextInterface $context Cake\View\Widget\WidgetInterface::render() secureFields( array $data )
Returns a list of fields that need to be secured for this widget.
When the hour picker is in 24hr mode (null or format=24) the meridian picker will be omitted.
$data Cake\View\Widget\WidgetInterface::secureFields() protected array
List of inputs that can be rendered
[
'year',
'month',
'day',
'hour',
'minute',
'second',
'meridian',
]
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.View.Widget.DateTimeWidget.html