From b1b900dfb35db2577f00e65c132f1bc053dd12b7 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 27 Jun 2017 12:08:23 +1000 Subject: [PATCH] adding theming --- booking.MailSystemInterface.inc | 42 +++++++++++++++++++++++++++++++++ booking.install | 21 +++++++++++++++++ booking.module | 16 ++++++++++++- theme/mimemail-message.tpl.php | 40 +++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 booking.MailSystemInterface.inc create mode 100644 theme/mimemail-message.tpl.php diff --git a/booking.MailSystemInterface.inc b/booking.MailSystemInterface.inc new file mode 100644 index 0000000..5c47cf9 --- /dev/null +++ b/booking.MailSystemInterface.inc @@ -0,0 +1,42 @@ + $value) { + $mimeheaders[] = $name . ': ' . mime_header_encode($value); + } + $line_endings = variable_get('mail_line_endings', MAIL_LINE_ENDINGS); + return mail( + $message['to'], + mime_header_encode($message['subject']), + preg_replace('@\r?\n@', $line_endings, $message['body']), + join("\n", $mimeheaders) + ); + } +} \ No newline at end of file diff --git a/booking.install b/booking.install index ab66583..d9a4170 100644 --- a/booking.install +++ b/booking.install @@ -690,6 +690,27 @@ function booking_uninstall() { //drupal_uninstall_schema('booking'); } +/** + * Implement hook_enable() + */ +function booking_enable() { + drupal_set_message($message = t('The Booking System module was successfully enabled.'), $type = 'status'); + //let MIME Mail know that we can send html emails + mailsystem_set(array( + 'booking' => 'BookingMailSystem', + )); +} + +/** + * Implement hook_disable() + */ +function booking_disable() { + drupal_set_message($message = t('The Booking System module was successfully disabled.'), $type = 'status'); + //clean up our entry about mailsystems + mailsystem_clear(array( + 'booking' => 'BookingMailSystem', + )); +} /** * Implementation of hook_schema(). diff --git a/booking.module b/booking.module index 07d93a0..89d0cf8 100644 --- a/booking.module +++ b/booking.module @@ -822,11 +822,25 @@ function booking_node_access($node, $op, $account) { /** * Implementation of hook_theme(). */ -function booking_theme() { +function booking_theme($existing, $type, $theme, $path) { + if($type == 'module') + { + return array( + 'booking_details' => array('arguments' => array('node' => NULL)), + 'booking_htmlmail_template' => array( + 'variables' => array('module' => NULL, 'key' => NULL, 'recipient' => NULL, 'subject' => NULL, 'body' => NULL, 'message' => array()), + 'path' => drupal_get_path('module', 'booking'). '/theme', + 'template' => 'mimemail-message' // extension of .tpl.php automatically added + ), + ); + } + return array(); //will raise fatal error if void +/* return array( 'booking_details' => array('arguments' => array('node' => NULL)), //'booking_price_admin' => array('arguments' => array('form' => NULL)) ); + */ } /** diff --git a/theme/mimemail-message.tpl.php b/theme/mimemail-message.tpl.php new file mode 100644 index 0000000..9d5c896 --- /dev/null +++ b/theme/mimemail-message.tpl.php @@ -0,0 +1,40 @@ + + + + + + + + + > +
+
+ +
+
+ + \ No newline at end of file