You are here

public function DateBase::getFormats in YAML Form 8

Get an element's available formats.

Return value

array An associative array of formats containing name/label pairs.

Overrides YamlFormElementBase::getFormats

File

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

Class

DateBase
Provides a base 'date' class.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getFormats() {
  $formats = parent::getFormats();
  $date_formats = DateFormat::loadMultiple();
  foreach ($date_formats as $date_format) {
    $formats[$date_format
      ->id()] = $date_format
      ->label();
  }
  return $formats;
}