From 79b2b0e50501d45669c3d12b2e45096142ae08cb Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 29 Aug 2017 22:48:26 +1000 Subject: [PATCH] change song choice to freestyle text --- booking.admin.inc | 10 ++++++++++ booking.install | 10 ++++++++++ booking.regn_form.inc | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/booking.admin.inc b/booking.admin.inc index 47be8e7..d111c34 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -575,6 +575,16 @@ function booking_admin() { ), '#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( '#type' => 'radios', '#title' => t('Allow attendee to specify dietary requirements?'), diff --git a/booking.install b/booking.install index fa5c0e8..b09b8e5 100644 --- a/booking.install +++ b/booking.install @@ -726,6 +726,16 @@ function booking_update_7248() { 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(). */ diff --git a/booking.regn_form.inc b/booking.regn_form.inc index da1a6d6..b004feb 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -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 : '' ); } + 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) { $form['submit'] = array(