function uc_select_year in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_store/uc_store.module \uc_select_year()
- 7.3 uc_store/uc_store.module \uc_select_year()
Create a year select box for a form.
3 calls to uc_select_year()
- uc_payment_method_cod_form in payment/
uc_payment_pack/ uc_payment_pack.module - uc_payment_method_credit_form in payment/
uc_credit/ uc_credit.module - uc_payment_pack_receive_check_form in payment/
uc_payment_pack/ uc_payment_pack.module - Receive a check for an order and put in a clear date.
File
- uc_store/
uc_store.module, line 2302 - Contains global Ubercart functions and store administration functionality.
Code
function uc_select_year($title = NULL, $default = NULL, $min = NULL, $max = NULL, $allow_empty = FALSE) {
$min = is_null($min) ? intval(date('Y')) : $min;
$max = is_null($max) ? intval(date('Y')) + 20 : $max;
$options = $allow_empty ? array(
'' => '',
) : array();
$select = array(
'#type' => 'select',
'#title' => is_null($title) ? t('Year') : $title,
'#options' => $options + drupal_map_assoc(range($min, $max)),
'#default_value' => is_null($default) ? 0 : $default,
);
return $select;
}