change song choice to freestyle text

This commit is contained in:
2017-08-29 22:48:26 +10:00
parent d568cf2043
commit 79b2b0e505
3 changed files with 29 additions and 0 deletions

View File

@@ -575,6 +575,16 @@ function booking_admin() {
), ),
'#default_value' => variable_get('booking_enable_songchoice', 0) '#default_value' => variable_get('booking_enable_songchoice', 0)
); );
$form['regn_options']['booking_enable_freestyle'] = array(
'#type' => 'radios',
'#title' => t('Enable attendee to enter freestyle text'),
'#description' => t('Select whether to include freestyle text field in the booking form.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_freestyle', 0)
);
$form['regn_options']['booking_enable_dietary'] = array( $form['regn_options']['booking_enable_dietary'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Allow attendee to specify dietary requirements?'), '#title' => t('Allow attendee to specify dietary requirements?'),

View File

@@ -726,6 +726,16 @@ function booking_update_7248() {
db_change_field('booking_person', 'booking_medical_conditions', 'booking_medical_conditions', $spec); db_change_field('booking_person', 'booking_medical_conditions', 'booking_medical_conditions', $spec);
} }
/**
* Add field for attendee's freestyle text entry
*/
function booking_update_7249() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_add_field('booking_person', 'booking_freestyle_text', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/** /**
* Implementation of hook_install(). * Implementation of hook_install().
*/ */

View File

@@ -941,6 +941,15 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
'#default_value' => !empty($data->booking_song_choice) ? $data->booking_song_choice : '' '#default_value' => !empty($data->booking_song_choice) ? $data->booking_song_choice : ''
); );
} }
if (variable_get('booking_enable_freestyle', 0) == 1) {
$form['misc-areas']['booking_freestyle_text'] = array(
'#type' => 'textfield',
'#title' => t("Freestyle (optional)"),
'#maxlength' => 500,
'#required' => FALSE,
'#default_value' => !empty($data->booking_freestyle_text) ? $data->booking_freestyle_text : ''
);
}
if ($inserting == TRUE) { if ($inserting == TRUE) {
$form['submit'] = array( $form['submit'] = array(