hide special requirements fieldset if not needed
This commit is contained in:
@@ -290,12 +290,22 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok
|
||||
),
|
||||
);
|
||||
*/
|
||||
$form['requirements'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => 'Special Requirements'
|
||||
);
|
||||
|
||||
//calculate which fields to show and whether we need to show the fieldset at all
|
||||
$show_dietary = variable_get('booking_enable_dietary', 0) == 1 || $inserting == FALSE;
|
||||
$show_medical = variable_get('booking_enable_medcond', 0) == 1 || $inserting == FALSE;
|
||||
$show_roommate = variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE;
|
||||
$show_bf_gf = $person->booking_partner_id == 0 || $inserting == FALSE;
|
||||
$show_special_requirements = ($show_dietary || $show_medical || $show_roommate || $show_bf_gf);
|
||||
|
||||
if ($show_special_requirements) {
|
||||
$form['requirements'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => 'Special Requirements'
|
||||
);
|
||||
}
|
||||
//only show the dietary field if we're allowed to
|
||||
if (variable_get('booking_enable_dietary', 0) == 1 || $inserting == FALSE) {
|
||||
if ($show_dietary) {
|
||||
$form['requirements']['booking_dietary'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Special dietary requirements?'),
|
||||
@@ -304,7 +314,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok
|
||||
);
|
||||
}
|
||||
//display the medical conditions question if it is enabled
|
||||
if (variable_get('booking_enable_medcond', 0) == 1 || $inserting == FALSE) {
|
||||
if ($show_medical) {
|
||||
$form['requirements']['booking_medical_conditions'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Please describe any medical condition we need to know about.'),
|
||||
@@ -315,7 +325,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok
|
||||
);
|
||||
}
|
||||
//only show the room mate field if we're allowed to
|
||||
if (variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE) {
|
||||
if ($show_roommate) {
|
||||
//married people won't need to select a room mate
|
||||
if ($person->booking_partner_id == 0) {
|
||||
$form['requirements']['booking_room_mate1'] = array(
|
||||
@@ -329,7 +339,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tok
|
||||
}
|
||||
}
|
||||
//only show this field if this person isn't married
|
||||
if ($person->booking_partner_id == 0 || $inserting == FALSE) {
|
||||
if ($show_bf_gf) {
|
||||
$form['requirements']['booking_bf_gf_nid'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
||||
|
Reference in New Issue
Block a user