function Datetime::getHtml5TimeFormat
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Datetime/Element/Datetime.php \Drupal\Core\Datetime\Element\Datetime::getHtml5TimeFormat()
- 10 core/lib/Drupal/Core/Datetime/Element/Datetime.php \Drupal\Core\Datetime\Element\Datetime::getHtml5TimeFormat()
- 11.x core/lib/Drupal/Core/Datetime/Element/Datetime.php \Drupal\Core\Datetime\Element\Datetime::getHtml5TimeFormat()
Retrieves the right format for an HTML5 time element.
The format is important because these elements will not work with any other format.
Parameters
array $element: The $element to assess.
Return value
string Returns the right format for the time element, or the original format if this is not an HTML5 element.
3 calls to Datetime::getHtml5TimeFormat()
- Datetime::processDatetime in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Expands a datetime element type into date and/or time elements.
- Datetime::validateDatetime in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Validation callback for a datetime element.
- Datetime::valueCallback in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Determines how user input is mapped to an element's #value property.
File
-
core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php, line 441
Class
- Datetime
- Provides a datetime element.
Namespace
Drupal\Core\Datetime\ElementCode
protected static function getHtml5TimeFormat($element) {
switch ($element['#date_time_element']) {
case 'time':
return DateFormat::load('html_time')->getPattern();
default:
return $element['#date_time_format'];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.