uc_select_year

Versions
5
uc_select_year($title = NULL, $default = NULL, $min = NULL, $max = NULL)
6
uc_select_year($title = NULL, $default = NULL, $min = NULL, $max = NULL, $allow_empty = FALSE)

Create a year select box for a form.

▾ 3 functions call uc_select_year()

uc_payment_method_cod_form in contributions/ubercart/payment/uc_payment_pack/uc_payment_pack.module
uc_payment_method_credit_form in contributions/ubercart/payment/uc_credit/uc_credit.module
uc_payment_pack_receive_check_form in contributions/ubercart/payment/uc_payment_pack/uc_payment_pack.module
Receive a check for an order and put in a clear date.

Code

contributions/ubercart/uc_store/uc_store.module, line 2288

<?php
function uc_select_year($title = NULL, $default = NULL, $min = NULL, $max = NULL) {
  $min = is_null($min) ? intval(date('Y')) : $min;
  $max = is_null($max) ? intval(date('Y')) + 20 : $max;

  $select = array(
    '#type' => 'select',
    '#title' => (is_null($title) ? t('Year') : $title),
    '#options' => drupal_map_assoc(range($min, $max)),
    '#default_value' => (is_null($default) ? 0 : $default),
  );

  return $select;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.