function merci_hours_form_element in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
Returns a merci hours selection form element.
Parameters
boolean include_default wether to add "use site default" as an option.:
integer default_value Id of the default merci hours.:
Return value
form element.
1 call to merci_hours_form_element()
- merci_hours_date_field_instance_settings_form_alter in merci_hours/
merci_hours.module - Implements hook_date_field_instance_settings_form_alter().
File
- merci_hours/
merci_hours.module, line 165
Code
function merci_hours_form_element($include_default = FALSE, $default_value = NULL) {
$options = array();
if ($include_default && variable_get('merci_hours_default', FALSE)) {
$options[0] = t('-- use site default --');
}
$options += db_select('merci_hours', 'wc')
->fields('wc', array(
'name',
'label',
))
->execute()
->fetchAllKeyed(0, 1);
$element = array(
'#type' => 'select',
'#title' => t('Choose merci hours'),
'#default_value' => $default_value,
'#options' => $options,
);
return $element;
}