You are here

public function DateBase::buildExportRecord in YAML Form 8

Build an element's export row.

Parameters

array $element: An element.

array $export_options: An associative array of export options.

Return value

array An array containing the element's export row.

Overrides YamlFormElementBase::buildExportRecord

See also

\Drupal\yamlform\YamlFormSubmissionExporterInterface::getDefaultExportOptions

File

src/Plugin/YamlFormElement/DateBase.php, line 116

Class

DateBase
Provides a base 'date' class.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function buildExportRecord(array $element, $value, array $export_options) {
  $element['#format'] = $this
    ->getDateType($element) === 'datetime' ? 'Y-m-d H:i:s' : 'Y-m-d';
  return [
    $this
      ->formatText($element, $value, $export_options),
  ];
}