protected function DateBase::getDateType in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/DateBase.php \Drupal\webform\Plugin\WebformElement\DateBase::getDateType()
Get the type of date/time element.
Parameters
array $element: An element.
Return value
string The type of date/time element which be either a 'date' or 'datetime'.
2 calls to DateBase::getDateType()
- DateBase::buildExportRecord in src/
Plugin/ WebformElement/ DateBase.php - Build an element's export row.
- DateBase::parseInputFormat in src/
Plugin/ WebformElement/ DateBase.php - Parse GNU Date Input Format.
File
- src/
Plugin/ WebformElement/ DateBase.php, line 355
Class
- DateBase
- Provides a base 'date' class.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function getDateType(array $element) {
switch ($element['#type']) {
case 'datelist':
return isset($element['#date_part_order']) && !in_array('hour', $element['#date_part_order']) ? 'date' : 'datetime';
case 'datetime':
return 'datetime';
case 'date':
default:
return 'date';
}
}