move footer definition to theme call

This commit is contained in:
2017-07-01 22:51:42 +10:00
parent 627b1767e8
commit 4ad18bf7fd
3 changed files with 8 additions and 7 deletions

View File

@@ -342,6 +342,10 @@ function _booking_custom_email($nid, $email_type, $sender = 'contact') {
$message_body = isset($message_body['format']) ? $message_body['value'] : $message_body; $message_body = isset($message_body['format']) ? $message_body['value'] : $message_body;
$message_body = token_replace($message_body, $tokens); $message_body = token_replace($message_body, $tokens);
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
//Check if we should apply a HTML theme to the email text or just send a normal email //Check if we should apply a HTML theme to the email text or just send a normal email
if(variable_get('booking_enable_html_mail', 0) == 1) { if(variable_get('booking_enable_html_mail', 0) == 1) {
$html_body = theme('booking_htmlmail_registration_mail', $html_body = theme('booking_htmlmail_registration_mail',
@@ -350,6 +354,7 @@ function _booking_custom_email($nid, $email_type, $sender = 'contact') {
'key' => 'booking_email_custom', 'key' => 'booking_email_custom',
'body' => $message_body, 'body' => $message_body,
'subject' => $subject, 'subject' => $subject,
'footer' => $message_footer,
)); ));
watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true))); watchdog('booking_debug', "<pre>HTML body themed\n@info</pre>", array('@info' => print_r($html_body, true)));
$params['body'] = $html_body; $params['body'] = $html_body;

View File

@@ -75,7 +75,7 @@ function booking_emails_admin() {
if(variable_get('booking_enable_html_mail', 0) == 1) { if(variable_get('booking_enable_html_mail', 0) == 1) {
$form['emails']['booking_html_mail_footer'] = array( $form['emails']['booking_html_mail_footer'] = array(
'#title' => t('Footer text for HTML email'), '#title' => t('Footer text for HTML email'),
'#description' => t('Enter HTML to go in the footer of the email template (above the social media icons).'), '#description' => t('Enter HTML to go in the footer of the email template (above the social media icons).<br /><strong>NOTE:</strong>&nbsp;No token subsitutions will be made here.'),
'#default_value' => isset(variable_get('booking_html_mail_footer')['value']) ? variable_get('booking_html_mail_footer')['value'] : variable_get('booking_html_mail_footer', '<p>&nbsp;</p>'), '#default_value' => isset(variable_get('booking_html_mail_footer')['value']) ? variable_get('booking_html_mail_footer')['value'] : variable_get('booking_html_mail_footer', '<p>&nbsp;</p>'),
'#type' => 'text_format', '#type' => 'text_format',
'#format' => 'full_html', '#format' => 'full_html',

View File

@@ -853,11 +853,7 @@ function booking_theme($existing, $type, $theme, $path) {
if($type == 'module') { if($type == 'module') {
$theme_path = drupal_get_path('module', 'booking'). '/theme'; $theme_path = drupal_get_path('module', 'booking'). '/theme';
// if our more heavily customised template exists, use that, otherwise fall back to the generic one // if our more heavily customised template exists, use that, otherwise fall back to the generic one
$template_file = is_file($theme_path . '/mimemail-message-registration_mail.tpl.php') ? '/mimemail-message-registration_mail' : '/mimemail-message'; $template_file = is_file($theme_path . '/mimemail-message-registration_mail.tpl.php') ? '/mimemail-message-registration_mail' : '/mimemail-message';
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
return array( return array(
'booking_details' => array('arguments' => array('node' => NULL)), 'booking_details' => array('arguments' => array('node' => NULL)),
@@ -867,7 +863,7 @@ function booking_theme($existing, $type, $theme, $path) {
'template' => 'mimemail-message' // extension of .tpl.php automatically added 'template' => 'mimemail-message' // extension of .tpl.php automatically added
), ),
'booking_htmlmail_registration_mail' => array( 'booking_htmlmail_registration_mail' => array(
'variables' => array('subject' => NULL, 'body' => NULL, 'footer' => $message_footer), 'variables' => array('subject' => NULL, 'body' => NULL, 'footer' => NULL),
'path' => $theme_path, 'path' => $theme_path,
'image_path' => drupal_get_path('module', 'booking'). '/images', 'image_path' => drupal_get_path('module', 'booking'). '/images',
'template' => $template_file, 'template' => $template_file,