protected function DateTimeExport::getFormatExportOptions in Entity Export CSV 8
Get the format options to export.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.
Return value
array An array of format options.
Overrides FieldTypeExportBase::getFormatExportOptions
File
- src/
Plugin/ FieldTypeExport/ DateTimeExport.php, line 115
Class
- DateTimeExport
- Defines a Datetime field type export plugin.
Namespace
Drupal\entity_export_csv\Plugin\FieldTypeExportCode
protected function getFormatExportOptions(FieldDefinitionInterface $field_definition) {
$options = parent::getFormatExportOptions($field_definition);
$date_formats = [];
foreach ($this->entityTypeManager
->getStorage('date_format')
->loadMultiple() as $machine_name => $value) {
$date_formats[$machine_name] = $this
->t('@name format: @date', [
'@name' => $value
->label(),
'@date' => $this->dateFormatter
->format(REQUEST_TIME, $machine_name),
]);
}
$date_formats['custom'] = $this
->t('Custom');
return $options + $date_formats;
}