You are here

function merci_restrictions_form_element in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

Returns a merci restrictions selection form element.

Parameters

boolean include_default wether to add "use site default" as an option.:

integer default_value Id of the default merci restrictions.:

Return value

form element.

File

merci_restrictions/merci_restrictions.module, line 258

Code

function merci_restrictions_form_element($include_default = FALSE, $default_value = NULL) {
  $options = array();
  if ($include_default && variable_get('merci_restrictions_default', FALSE)) {
    $options[0] = t('-- use site default --');
  }
  $options += db_select('merci_restrictions', 'wc')
    ->fields('wc', array(
    'name',
    'label',
  ))
    ->execute()
    ->fetchAllKeyed(0, 1);
  $element = array(
    '#type' => 'select',
    '#title' => t('Choose merci restrictions'),
    '#default_value' => $default_value,
    '#options' => $options,
  );
  return $element;
}