From 73185c28f394d28be66f5ea6dd52048fc1ecd550 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 27 Jun 2017 20:44:35 +1000 Subject: [PATCH] increase flexibility in form --- booking.emails_admin.inc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/booking.emails_admin.inc b/booking.emails_admin.inc index 7c077e3..9d8daf0 100644 --- a/booking.emails_admin.inc +++ b/booking.emails_admin.inc @@ -49,15 +49,12 @@ function booking_emails_admin() { $booking_email_paymentoutstanding_married_text = ""; if(variable_get('booking_enable_html_mail', 0) == 1) { - $textarea_defaults = array( - '#type' => 'text_format', - '#format' => 'full_html', - ); + $form_type = 'text_format'; + $form_format = 'full_html'; } else { - $textarea_defaults = array( - '#type' => 'textarea', - ); + $form_type = 'textarea'; + $form_format = NULL; } //include the token definitions @@ -83,11 +80,10 @@ 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' => variable_get('booking_email_bookedin_text')['value'], - '#type' => 'text_format', - '#format' => 'full_html', + '#default_value' => $form_type == 'text_format' ? variable_get('booking_email_bookedin_text')['value'] : variable_get('booking_email_bookedin_text'), + '#type' => $form_type, + '#format' => $form_format, ); - //$form['emails']['booking_email_bookedin_text'] += $textarea_defaults; $form['emails']['booking_email_regn_complete_text'] = array( '#title' => t('Payment Complete Email'), '#type' => 'textarea',