You are here

private static function DatexDateList::datexYears in Datex 8

File

src/Element/DatexDateList.php, line 242

Class

DatexDateList
Plugin annotation @FormElement("datelist");

Namespace

Drupal\datex\Element

Code

private static function datexYears(DatexInterface $cal, $min, $max, $required) {
  $cal
    ->setTimestamp(REQUEST_TIME);
  $rng = range(empty($min) ? intval($cal
    ->format('Y') - 3) : $min, empty($max) ? intval($cal
    ->format('Y') + 3) : $max);
  $rng = array_combine($rng, $rng);
  $options = !$required ? [
    '' => '',
  ] + $rng : $rng;
}