You are here

function uc_select_year in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_store/uc_store.module \uc_select_year()
  2. 6.2 uc_store/uc_store.module \uc_select_year()

Creates 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
Collect additional information for the "Cash on Delivery" payment method.
uc_payment_method_credit_form in payment/uc_credit/uc_credit.module
Displays the credit card details form on the checkout screen.
uc_payment_pack_receive_check_form in payment/uc_payment_pack/uc_payment_pack.admin.inc
Receives a check for an order and put in a clear date.

File

uc_store/uc_store.module, line 1433
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;
}