function rooms_booking_type_form in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Generates the Booking type editing form.
File
- modules/
rooms_booking/ rooms_booking_type.admin.inc, line 32 - RoomsBooking type editing UI.
Code
function rooms_booking_type_form($form, &$form_state, $booking_type, $op = 'edit') {
$form['#attributes']['class'][] = 'rooms-management-form rooms-booking-type-form';
if ($op == 'clone') {
$booking_type->label .= ' (cloned)';
$booking_type->type = '';
}
$form['label'] = array(
'#title' => t('Label'),
'#type' => 'textfield',
'#default_value' => $booking_type->label,
'#description' => t('The human-readable name of this booking type.'),
'#required' => TRUE,
'#size' => 30,
);
// Machine-readable type name.
$form['type'] = array(
'#type' => 'machine_name',
'#default_value' => isset($booking_type->type) ? $booking_type->type : '',
'#maxlength' => 32,
'#machine_name' => array(
'exists' => 'rooms_booking_get_types',
'source' => array(
'label',
),
),
'#description' => t('A unique machine-readable name for this booking type. It must only contain lowercase letters, numbers, and underscores.'),
);
$form['actions'] = array(
'#type' => 'actions',
'#tree' => FALSE,
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Booking type'),
'#weight' => 40,
);
return $form;
}