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',
|
//calculate which fields to show and whether we need to show the fieldset at all
|
||||||
'#title' => 'Special Requirements'
|
$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
|
//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(
|
$form['requirements']['booking_dietary'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Special dietary requirements?'),
|
'#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
|
//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(
|
$form['requirements']['booking_medical_conditions'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Please describe any medical condition we need to know about.'),
|
'#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
|
//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
|
//married people won't need to select a room mate
|
||||||
if ($person->booking_partner_id == 0) {
|
if ($person->booking_partner_id == 0) {
|
||||||
$form['requirements']['booking_room_mate1'] = array(
|
$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
|
//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(
|
$form['requirements']['booking_bf_gf_nid'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
||||||
|
Reference in New Issue
Block a user