diff --git a/booking.emails_admin.inc b/booking.emails_admin.inc index 7f2ed4e..00f48d7 100644 --- a/booking.emails_admin.inc +++ b/booking.emails_admin.inc @@ -80,7 +80,7 @@ function booking_emails_admin() { $form['emails']['booking_email_bookedin_text'] = array( '#title' => t('Registration Successful Email'), '#description' => t('Text to use in an email indicating the person has booked in, paid their deposit and is not on the waiting list'), - '#default_value' => $form_type == 'text_format' ? variable_get('booking_email_bookedin_text')['value'] : variable_get('booking_email_bookedin_text', $default_email_text), + '#default_value' => isset(variable_get('booking_email_bookedin_text')['value']) ? variable_get('booking_email_bookedin_text')['value'] : variable_get('booking_email_bookedin_text', $default_email_text), '#type' => $form_type, '#format' => $form_format, ); @@ -96,16 +96,16 @@ function booking_emails_admin() { '#title' => t('Registration on Waiting List Email'), '#description' => t('Email text to indicate a person has registered but is on the waiting list. ' . 'This will be sent instead of the Registration Successful or Registration Complete emails if the person is on the waiting list.'), - '#default_value' => $form_type == 'text_format' ? variable_get('booking_email_waitinglist_text')['value'] : variable_get('booking_email_waitinglist_text', $booking_email_waitinglist_text), + '#default_value' => isset(variable_get('booking_email_waitinglist_text')['value']) ? variable_get('booking_email_waitinglist_text')['value'] : variable_get('booking_email_waitinglist_text', $booking_email_waitinglist_text), '#type' => $form_type, '#format' => $form_format, ); $form['emails']['booking_email_partialpayment_received_text'] = array( '#title' => t('Email text to send a person thanking them for their partial payment'), - '#type' => 'textarea', - //'#format' => 'full_html', '#description' => t(''), - '#default_value' => variable_get('booking_email_partialpayment_received_text', ''), + '#default_value' => isset(variable_get('booking_email_partialpayment_received_text')['value']) ? variable_get('booking_email_partialpayment_received_text')['value'] : variable_get('booking_email_partialpayment_received_text', ''), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_paymentoutstanding_subject'] = array ( '#type' => 'textfield', @@ -117,24 +117,25 @@ function booking_emails_admin() { ); $form['emails']['booking_email_paymentoutstanding_text'] = array( '#description' => t('Email text to send a person reminding them of how much they owe'), - '#type' => 'textarea', - //'#format' => 'full_html', '#title' => t('Balance Outstanding Email Text'), - '#default_value' => variable_get('booking_email_paymentoutstanding_text', $booking_email_paymentoutstanding_text), + '#default_value' => isset(variable_get('booking_email_paymentoutstanding_text')['value']) ? variable_get('booking_email_paymentoutstanding_text')['value'] : variable_get('booking_email_paymentoutstanding_text', $booking_email_paymentoutstanding_text), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_paymentoutstanding_married_text'] = array( '#title' => t('Email text to send a married couple reminding them of how much they both owe (only applies when combined pricing enabled)'), - '#type' => 'textarea', - //'#format' => 'full_html', - '#description' => t(''), - '#default_value' => variable_get('booking_email_paymentoutstanding_married_text', $booking_email_paymentoutstanding_married_text), + '#description' => t(''), + '#default_value' => isset(variable_get('booking_email_paymentoutstanding_married_text')['value']) ? variable_get('booking_email_paymentoutstanding_married_text')['value'] : variable_get('booking_email_paymentoutstanding_married_text', $booking_email_paymentoutstanding_married_text), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_waitinglistpromotion'] = array( '#title' => t('Email text to send a person on the waiting list when a spot opens up for them'), - '#type' => 'textarea', - '#description' => t(''), - '#default_value' => variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion), + '#description' => t(''), + '#default_value' => isset(variable_get('booking_email_waitinglistpromotion')['value']) ? variable_get('booking_email_waitinglistpromotion')['value'] : variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_notcoming_demotion_subject'] = array ( '#type' => 'textfield', @@ -146,9 +147,10 @@ function booking_emails_admin() { ); $form['emails']['booking_email_notcoming_demotion'] = array( '#title' => t('Email text to send a person who withdraws their registration'), - '#type' => 'textarea', - '#description' => t(''), - '#default_value' => variable_get('booking_email_notcoming_demotion', $booking_email_notcoming_demotion), + '#description' => t(''), + '#default_value' => isset(variable_get('booking_email_notcoming_demotion')['value']) ? variable_get('booking_email_notcoming_demotion')['value'] : variable_get('booking_email_notcoming_demotion', $booking_email_notcoming_demotion), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_missedpayment_subject'] = array ( '#type' => 'textfield', @@ -160,9 +162,10 @@ function booking_emails_admin() { ); $form['emails']['booking_email_missedpayment'] = array( '#title' => t('Missed Payment Email Text'), - '#type' => 'textarea', '#description' => t('Email text to send a person who missed the payment deadline'), - '#default_value' => variable_get('booking_email_missedpayment', ''), + '#default_value' => isset(variable_get('booking_email_missedpayment')['value']) ? variable_get('booking_email_missedpayment')['value'] : variable_get('booking_email_missedpayment', ''), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_travel_initial_email_subject'] = array ( '#type' => 'textfield', @@ -175,8 +178,9 @@ function booking_emails_admin() { $form['emails']['booking_email_travel_initial_email_text'] = array( '#title' => t('Initial Travel Form Required Text'), '#description' => t('Text for first email requesting attendee to complete the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))), - '#type' => 'textarea', - '#default_value' => variable_get('booking_email_travel_initial_email_text', ''), + '#default_value' => isset(variable_get('booking_email_travel_initial_email_text')['value']) ? variable_get('booking_email_travel_initial_email_text')['value'] : variable_get('booking_email_travel_initial_email_text', ''), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_travel_reminder_email_subject'] = array ( '#type' => 'textfield', @@ -189,8 +193,9 @@ function booking_emails_admin() { $form['emails']['booking_email_travel_reminder_email_text'] = array( '#title' => t('Reminder Travel Form Required Text'), '#description' => t('Text for reminder email requesting attendee to complete the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))), - '#type' => 'textarea', - '#default_value' => variable_get('booking_email_travel_reminder_email_text', ''), + '#default_value' => isset(variable_get('booking_email_travel_reminder_email_text')['value']) ? variable_get('booking_email_travel_reminder_email_text')['value'] : variable_get('booking_email_travel_reminder_email_text', ''), + '#type' => $form_type, + '#format' => $form_format, ); $form['emails']['booking_email_travel_complete_subject'] = array ( '#type' => 'textfield', @@ -203,8 +208,9 @@ function booking_emails_admin() { $form['emails']['booking_email_travel_complete_text'] = array( '#title' => t('Travel Form Complete Text'), '#description' => t('Email text to indicate a person has completed the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))), - '#type' => 'textarea', - '#default_value' => variable_get('booking_email_travel_complete_text', ''), + '#default_value' => isset(variable_get('booking_email_travel_complete_text')['value']) ? variable_get('booking_email_travel_complete_text')['value'] : variable_get('booking_email_travel_complete_text', ''), + '#type' => $form_type, + '#format' => $form_format, ); /*Text for emails*/ @@ -228,9 +234,10 @@ function booking_emails_admin() { ); $form['custom-emails'][$body_fieldname] = array( '#title' => t('Email text for custom email ' . $i), - '#type' => 'textarea', - '#description' => t(''), - '#default_value' => variable_get($body_fieldname, ''), + '#description' => t(''), + '#default_value' => isset(variable_get($body_fieldname)['value']) ? variable_get($body_fieldname)['value'] : variable_get($body_fieldname, ''), + '#type' => $form_type, + '#format' => $form_format, ); } @@ -256,9 +263,10 @@ function booking_emails_admin() { ); $form['custom-logistics-emails'][$body_fieldname] = array( '#title' => t('Email text for Logistics Custom Email ' . $i), - '#type' => 'textarea', '#description' => t(''), - '#default_value' => variable_get($body_fieldname, ''), + '#default_value' => isset(variable_get($body_fieldname)['value']) ? variable_get($body_fieldname)['value'] : variable_get($body_fieldname, ''), + '#type' => $form_type, + '#format' => $form_format, ); }