You are here

function _merci_choice_form in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 merci.module \_merci_choice_form()
  2. 7.2 merci.module \_merci_choice_form()

Builds an individual item selector.

Parameters

$node: The reservation node object.

$form_state: Current form state array.

$delta: Which selector number to build.

$default: Default value for the select.

Return value

The form array for the selector.

2 calls to _merci_choice_form()
merci_choice_js in ./merci.module
Menu callback for AHAH additions.
merci_form in ./merci.module
Implementation of hook_form().

File

./merci.module, line 960
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function _merci_choice_form($node, $form_state, $delta, $default = '') {
  $form = array(
    '#tree' => TRUE,
  );

  // We'll manually set the #parents property of these fields so that
  // their values appear in the $form_state['values']['choice'] array.
  $options = merci_build_reservable_items($node, $form_state);
  $form['item'] = array(
    '#type' => 'select',
    '#title' => t('Reserve item @n', array(
      '@n' => $delta + 1,
    )),
    '#options' => $options['options'],
    '#default_value' => $default,
    '#parents' => array(
      'choice',
      $delta,
      'item',
    ),
  );
  return $form;
}