You are here

public static function TimeFieldStandardWidget::defaultSettings in Timefield 1.0.x

Defines the default settings for this plugin.

Return value

array A list of default settings, keyed by the setting name.

Overrides PluginSettingsBase::defaultSettings

File

src/Plugin/Field/FieldWidget/TimeFieldStandardWidget.php, line 125

Class

TimeFieldStandardWidget
Plugin implementation of the 'timefield_standard_widget' widget.

Namespace

Drupal\timefield\Plugin\Field\FieldWidget

Code

public static function defaultSettings() {
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('timefield', 'timepicker');
  return [
    'disable_plugin' => empty($library) ? TRUE : FALSE,
    'input_format' => [
      'separator' => ':',
      'showLeadingZero' => FALSE,
      'showMinutesLeadingZero' => TRUE,
      'showPeriod' => TRUE,
      'periodSeparator' => '',
      'showHours' => TRUE,
      'showMinutes' => TRUE,
      'am_text' => 'AM',
      'pm_text' => 'PM',
      'minute_interval' => 5,
      'showCloseButton' => FALSE,
      'closeButtonText' => 'Done',
      'showNowButton' => FALSE,
      'nowButtonText' => 'Now',
      'showDeselectButton' => FALSE,
      'deselectButtonText' => 'Deselect',
      'myPosition' => 'left top',
      'atPosition' => 'left bottom',
    ],
  ] + parent::defaultSettings();
}