protected function _yearSelect($options, $context)
    {
        $options += [
            'name' => '',
            'val' => null,
            'start' => date('Y', strtotime('-5 years')),
            'end' => date('Y', strtotime('+5 years')),
            'order' => 'desc',
            'templateVars' => [],
            'options' => []
        ];

        if (!empty($options['val'])) {
            $options['start'] = min($options['val'], $options['start']);
            $options['end'] = max($options['val'], $options['end']);
        }
        if (empty($options['options'])) {
            $options['options'] = $this->_generateNumbers($options['start'], $options['end']);
        }
        if ($options['order'] === 'desc') {
            $options['options'] = array_reverse($options['options'], true);
        }
        unset($options['start'], $options['end'], $options['order']);

        return $this->_select->render($options, $context);
    }
protected function _yearSelect($options, $context)
    {
        $options += [
            'name' => '',
            'val' => null,
            'start' => date('Y', strtotime('-5 years')),
            'end' => date('Y', strtotime('+5 years')),
            'order' => 'desc',
            'templateVars' => [],
            'options' => []
        ];

        if (!empty($options['val'])) {
            $options['start'] = min($options['val'], $options['start']);
            $options['end'] = max($options['val'], $options['end']);
        }
        if (empty($options['options'])) {
            $options['options'] = $this->_generateNumbers($options['start'], $options['end']);
        }
        if ($options['order'] === 'desc') {
            $options['options'] = array_reverse($options['options'], true);
        }
        unset($options['start'], $options['end'], $options['order']);

        return $this->_select->render($options, $context);
    }
protected function _yearSelect ( $ options , $ context ) { $ options += [ 'name' => '' , 'val' => null , 'start' => date ( 'Y' , strtotime ( '-5 years' ) ) , 'end' => date ( 'Y' , strtotime ( '+5 years' ) ) , 'order' => 'desc' , 'templateVars' => [ ] , 'options' => [ ] ] ; if ( ! empty ( $ options [ 'val' ] ) ) { $ options [ 'start' ] = min ( $ options [ 'val' ] , $ options [ 'start' ] ) ; $ options [ 'end' ] = max ( $ options [ 'val' ] , $ options [ 'end' ] ) ; } if ( empty ( $ options [ 'options' ] ) ) { $ options [ 'options' ] = $ this -> _generateNumbers ( $ options [ 'start' ] , $ options [ 'end' ] ) ; } if ( $ options [ 'order' ] === 'desc' ) { $ options [ 'options' ] = array_reverse ( $ options [ 'options' ] , true ) ; } unset ( $ options [ 'start' ] , $ options [ 'end' ] , $ options [ 'order' ] ) ; return $ this -> _select -> render ( $ options , $ context ) ; }
Generates a year select

@param array $options Options list.
@param \Cake\View\Form\ContextInterface $context The current form context.
@return string
Generates a year select