You are here

public function DateFieldWidgetBase::formatOptions in Date 8

Return the format options used by this widget.

1 call to DateFieldWidgetBase::formatOptions()
DateFieldListWidget::settingsForm in date_field/lib/Drupal/date_field/Plugin/field/widget/DateFieldListWidget.php
Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().

File

date_field/lib/Drupal/date_field/Plugin/field/widget/DateFieldWidgetBase.php, line 54
Definition of Drupal\date_field\Plugin\field\widget\DateFieldWidgetBase.

Class

DateFieldWidgetBase
Abstract class for all date widgets.

Namespace

Drupal\date_field\Plugin\field\widget

Code

public function formatOptions() {
  $options = array();
  $formats = date_datepicker_formats();
  $example_date = date_example_date();
  foreach ($formats as $f) {
    $options[$f] = $example_date
      ->format($f);
  }
  return $options;
}