You are here

public static function TimePickerWidget::defaultSettings in Date Popup Timepicker 8

Defines the default settings for this plugin.

Return value

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

Overrides PluginSettingsBase::defaultSettings

1 call to TimePickerWidget::defaultSettings()
DateRangeTimePickerWidget::defaultSettings in src/Plugin/Field/FieldWidget/DateRangeTimePickerWidget.php
Defines the default settings for this plugin.

File

src/Plugin/Field/FieldWidget/TimePickerWidget.php, line 40

Class

TimePickerWidget
Plugin implementation of the 'datetime_timepicker' widget.

Namespace

Drupal\date_popup_timepicker\Plugin\Field\FieldWidget

Code

public static function defaultSettings() {
  return [
    // Define whether or not to show a leading zero for hours < 10.
    'showLeadingZero' => TRUE,
    // Define whether or not to show a leading zero for minutes < 10.
    'showMinutesLeadingZero' => TRUE,
    // Define an alternate input to parse selected time to.
    'altField' => '#alternate_input',
    // Used as default time when input field is empty or for inline
    // timePicker.
    // Set to 'now' for the current time, '' for no highlighted time.
    'defaultTime' => 'now',
    // Trigger options.
    // Define when the timepicker is shown.
    // 'focus': when the input gets focus, 'button' when the button
    // trigger element is clicked.
    // 'both': when the input gets focus and when the button is clicked.
    'showOn' => 'focus',
    // jQuery selector that acts as button trigger. ex: '#trigger_button'.
    'button' => NULL,
    // Localization.
    // Define the locale text for "Hours".
    'hourText' => 'Hour',
    // Define the locale text for "Minute".
    'minuteText' => 'Minute',
    // Define the locale text for periods.
    'amPmText' => [
      'AM',
      'PM',
    ],
    // Position.
    // Corner of the dialog to position, used with the jQuery UI Position
    // utility if present.
    'myPosition' => 'left top',
    // Corner of the input to position.
    'atPosition' => 'left bottom',
    // Events.
    // Callback function executed before the timepicker is
    // rendered and displayed.
    'beforeShow' => NULL,
    // Define a callback function when an hour / minutes is selected.
    'onSelect' => NULL,
    // Define a callback function when the timepicker is closed.
    'onClose' => NULL,
    // Define a callback to enable / disable certain hours.
    // ex: function onHourShow(hour).
    'onHourShow' => NULL,
    // Define a callback to enable / disable certain minutes. ex:
    // function onMinuteShow(hour, minute).
    'onMinuteShow' => NULL,
    // Custom hours and minutes.
    'hours' => [
      // First displayed hour.
      'starts' => 0,
      // Last displayed hour.
      'ends' => 23,
    ],
    'minutes' => [
      // First displayed minute.
      'starts' => 0,
      // Last displayed minute.
      'ends' => 55,
      // Interval of displayed minutes.
      'interval' => 5,
      // Optional extra entries for minutes.
      'manual' => [],
    ],
    // Number of rows for the input tables, minimum 2,
    // makes more sense if you use multiple of 2.
    'rows' => 4,
    // Define if the hours section is displayed or not.
    // Set to false to get a minute only dialog.
    'showHours' => TRUE,
    // Define if the minutes section is displayed or not.
    // Set to false to get an hour only dialog.
    'showMinutes' => TRUE,
    // Min and Max time.
    // Set the minimum time selectable by the user, disable hours and minutes
    // previous to min time.
    'minTime' => [
      'hour' => 0,
      'minute' => 0,
    ],
    // Set the minimum time selectable by the user, disable hours and minutes
    // after max time.
    'maxTime' => [
      'hour' => 23,
      'minute' => 59,
    ],
    // Buttons.
    // Shows an OK button to confirm the edit.
    'showCloseButton' => FALSE,
    // Text for the confirmation button (ok button).
    'closeButtonText' => 'Done',
    // Shows the 'now' button.
    'showNowButton' => FALSE,
    // Text for the now button.
    'nowButtonText' => 'Now',
    // Shows the deselect time button.
    'showDeselectButton' => FALSE,
    // Text for the deselect button.
    'deselectButtonText' => 'Deselect',
  ] + parent::defaultSettings();
}