Cake\View\Helper\FormHelper::hour PHP Метод

hour() публичный Метод

### Attributes: - empty - If true, the empty select option is shown. If a string, that string is displayed as the empty element. - value The selected value of the input. - format Set to 12 or 24 to use 12 or 24 hour formatting. Defaults to 24.
public hour ( string $fieldName, array $options = [] ) : string
$fieldName string Prefix name for the SELECT element
$options array List of HTML attributes
Результат string Completed hour select input
    public function hour($fieldName, array $options = [])
    {
        $options += ['format' => 24];
        $options = $this->_singleDatetime($options, 'hour');
        $options['timeFormat'] = $options['format'];
        unset($options['format']);
        if (isset($options['val']) && $options['val'] > 0 && $options['val'] <= 24) {
            $options['val'] = ['hour' => (int) $options['val'], 'minute' => date('i')];
        }
        return $this->dateTime($fieldName, $options);
    }

Usage Example

 public function hour($fieldName, array $options = [])
 {
     $options = $this->_injectStyles($options, 'form-control');
     return parent::hour($fieldName, $options);
 }