You are here

protected function SettingsForm::getRefreshFrequencyOptions in Instagram Feeds 8

Get options for the Long-Lived Token Refresh Frequency field.

Return value

array The list of time intervals where keys are time in seconds.

1 call to SettingsForm::getRefreshFrequencyOptions()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Form/SettingsForm.php, line 319

Class

SettingsForm
Defines an Instagram Feeds configuration form.

Namespace

Drupal\instagram_feeds\Form

Code

protected function getRefreshFrequencyOptions() {
  $days = [
    2,
    5,
    7,
    10,
    14,
    30,
    45,
    59,
  ];

  /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
  $date_formatter = \Drupal::service('date.formatter');
  $period = array_map(function ($val) {
    return $val * 86400;
  }, $days);
  return array_map([
    $date_formatter,
    'formatInterval',
  ], array_combine($period, $period));
}