You are here

function build_options in Demonstration site (Sandbox / Snapshot) 8

Build options for cron interval.

Parameters

$intervals: The filename of the snapshot.

1 call to build_options()
DemoAdminSettings::buildForm in src/Form/DemoAdminSettings.php
Form constructor.

File

./demo.module, line 901

Code

function build_options(array $intervals, $granularity = 2, $langcode = NULL) {
  $callback = function ($value) use ($granularity, $langcode) {
    return \Drupal::service('date.formatter')
      ->formatInterval($value, $granularity, $langcode);
  };
  return array_combine($intervals, array_map($callback, $intervals));
}