You are here

public static function FormHelper::getCronIntervalOptions in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::getCronIntervalOptions()

Return value

array

2 calls to FormHelper::getCronIntervalOptions()
SimplesitemapEnginesForm::buildForm in modules/simple_sitemap_engines/src/Form/SimplesitemapEnginesForm.php
Form constructor.
SimplesitemapSettingsForm::buildForm in src/Form/SimplesitemapSettingsForm.php
Form constructor.

File

src/Form/FormHelper.php, line 594

Class

FormHelper
Class FormHelper @package Drupal\simple_sitemap\Form

Namespace

Drupal\simple_sitemap\Form

Code

public static function getCronIntervalOptions() {

  /** @var \Drupal\Core\Datetime\DateFormatter $formatter */
  $formatter = \Drupal::service('date.formatter');
  $intervals = array_flip(self::$cronIntervals);
  foreach ($intervals as $interval => &$label) {
    $label = $formatter
      ->formatInterval($interval * 60 * 60);
  }
  return [
    0 => t('On every cron run'),
  ] + $intervals;
}