protected function FloodSettings::buildOptions in Flood settings 8
Provide DateFormatter interval.
Parameters
array $time_intervals: Intervals time array.
int $granularity: Ganularity value.
string|null $langcode: Langcode value.
Return value
array Return an array.
1 call to FloodSettings::buildOptions()
- FloodSettings::buildForm in src/
Form/ FloodSettings.php - Form constructor.
File
- src/
Form/ FloodSettings.php, line 188
Class
- FloodSettings
- Class FloodSettings.
Namespace
Drupal\flood_settings\FormCode
protected function buildOptions(array $time_intervals, $granularity = 2, $langcode = NULL) {
$callback = function ($value) use ($granularity, $langcode) {
return $this->dateFormatter
->formatInterval($value, $granularity, $langcode);
};
return array_combine($time_intervals, array_map($callback, $time_intervals));
}