You are here

public static function FormHelper::getCronIntervalOptions in Simple XML sitemap 4.x

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

Return value

array

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

File

src/Form/FormHelper.php, line 577

Class

FormHelper
Class FormHelper

Namespace

Drupal\simple_sitemap\Form

Code

public static function getCronIntervalOptions() : array {

  /** @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;
}