protected function DateBase::getDateType in YAML Form 8
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'.
3 calls to DateBase::getDateType()
- DateBase::buildExportRecord in src/
Plugin/ YamlFormElement/ DateBase.php - Build an element's export row.
- DateBase::formatText in src/
Plugin/ YamlFormElement/ DateBase.php - Format an element's value as plain text.
- DateBase::parseInputFormat in src/
Plugin/ YamlFormElement/ DateBase.php - Parse GNU Date Input Format.
File
- src/
Plugin/ YamlFormElement/ DateBase.php, line 187
Class
- DateBase
- Provides a base 'date' class.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
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';
}
}