function DateTimeRangeTrait::getFromToOptions

Same name in other branches
  1. 11.x core/modules/datetime_range/src/DateTimeRangeTrait.php \Drupal\datetime_range\DateTimeRangeTrait::getFromToOptions()

Returns a list of possible values for the 'from_to' setting.

Return value

array A list of 'from_to' options.

2 calls to DateTimeRangeTrait::getFromToOptions()
DateTimeRangeTrait::dateTimeRangeSettingsForm in core/modules/datetime_range/src/DateTimeRangeTrait.php
Configuration form for date time range.
DateTimeRangeTrait::dateTimeRangeSettingsSummary in core/modules/datetime_range/src/DateTimeRangeTrait.php
Gets the date time range settings summary.

File

core/modules/datetime_range/src/DateTimeRangeTrait.php, line 120

Class

DateTimeRangeTrait
Provides friendly methods for datetime range.

Namespace

Drupal\datetime_range

Code

protected function getFromToOptions() : array {
    return [
        DateTimeRangeConstantsInterface::BOTH => $this->t('Display both start and end dates'),
        DateTimeRangeConstantsInterface::START_DATE => $this->t('Display start date only'),
        DateTimeRangeConstantsInterface::END_DATE => $this->t('Display end date only'),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.