make songchoice and freestyle text configurable

This commit is contained in:
Nathan Coad
2019-09-08 16:17:39 +10:00
parent 22bad5d8ef
commit 7869a9be5b
2 changed files with 26 additions and 3 deletions

View File

@@ -676,7 +676,28 @@ function booking_admin() {
'#maxlength' => 3,
'#default_value' => variable_get('booking_earlyaccess_codes_count', '0'),
);
$form['regn_options']['booking_require_songchoice'] = array(
'#type' => 'radios',
'#title' => t('Require attendees to enter a song?'),
'#description' => t('Select whether to require attendees to enter a song choice for the week when they register.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_require_songchoice', 0)
);
$form['regn_options']['booking_enable_freestyle'] = array(
'#type' => 'radios',
'#title' => t('Require attendees to enter some freestyle text?'),
'#description' => t('Select whether to require attendees to enter some freestyle text when they register.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_freestyle', 0)
);
$form['management'] = array(
'#type' => 'fieldset',
'#title' => 'Data Management Options',

View File

@@ -938,20 +938,22 @@ function booking_form($node, &$form_state, $inserting = FALSE)
);
*/
if (variable_get('booking_enable_songchoice', 0) == 1) {
$songchoice_required_check = (variable_get('booking_require_songchoice', 1) == 1) && $inserting;
$form['misc-areas']['booking_song_choice'] = array(
'#type' => 'textfield',
'#title' => t("Let us know if there's a song you'd love to sing during the week"),
'#maxlength' => 200,
'#required' => TRUE,
'#required' => $songchoice_required_check,
'#default_value' => !empty($data->booking_song_choice) ? $data->booking_song_choice : ''
);
}
if (variable_get('booking_enable_freestyle', 0) == 1) {
$freestyle_required_check = (variable_get('booking_require_freestyle', 1) == 1) && $inserting;
$form['misc-areas']['booking_freestyle_text'] = array(
'#type' => 'textfield',
'#title' => t("Freestyle (optional)"),
'#maxlength' => 500,
'#required' => FALSE,
'#required' => $freestyle_required_check,
'#default_value' => !empty($data->booking_freestyle_text) ? $data->booking_freestyle_text : ''
);
}