function CalendarSystemsPartialImplementation::listOptions in Calendar Systems 8.3
Overrides CalendarSystemsInterface::listOptions
File
- src/
CalendarSystems/ CalendarSystemsPartialImplementation.php, line 28
Class
Namespace
Drupal\calendar_systems\CalendarSystemsCode
function listOptions($name, $required) {
$none = [
'' => '',
];
$year = $this
->getBaseYear();
switch ($name) {
case 'monthNames':
$m = [];
for ($i = 1; $i < 13; $i++) {
$this
->setDateLocale($year, $i, 1);
$m[$i] = $this
->format('F');
}
return !$required ? $none + $m : $m;
case 'monthNamesAbbr':
$m = [];
for ($i = 1; $i < 13; $i++) {
$this
->setDateLocale($year, $i, 1);
$m[$i] = $this
->format('M');
}
return !$required ? $none + $m : $m;
}
return $none;
}