Commit f419fb3c authored by Bob Vincent's avatar Bob Vincent
Browse files

More docs updates and backport work.

parent 9a10fa67
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -31,9 +31,9 @@ function htmlmail_admin_settings() {
      // Begin instructions.
'<p>When formatting an email message, Drupal determines the active template directory by looking for <code>htmlmail.tpl.php</code> file in the following locations:</p>
<ul>
  <li><a href="http://api.drupal.org/api/drupal/includes--theme.inc/function/path_to_theme/7">path_to_theme()</a></li>
  <li><a href="http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_path/7">drupal_get_path(</a>"module", <a href="http://api.drupal.org/api/drupal/developer--globals.php/global/installed_profile/7">$installed_profile</a>)</li>
  <li><a href="http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_path/7">drupal_get_path(</a>"module", <a href="http://drupal.org/project/htmlmail">"htmlmail"</a>)</li>
  <li><a href="http://api.drupal.org/api/drupal/includes--theme.inc/function/path_to_theme/6">path_to_theme()</a></li>
  <li><a href="http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_path/6">drupal_get_path(</a>"module", <a href="http://api.drupal.org/api/drupal/developer--globals.php/global/installed_profile/6">$installed_profile</a>)</li>
  <li><a href="http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_path/6">drupal_get_path(</a>"module", <a href="http://drupal.org/project/htmlmail">"htmlmail"</a>)</li>
</ul>
<p>Once the active template directory is found, Drupal looks in that directory for template files in order from most specific to most general.</p>
<p>For example, if <code>example\_module</code> sends mail with:</p>
@@ -45,14 +45,14 @@ function htmlmail_admin_settings() {
  <li><code>htmlmail-example\_module.tpl.php</code></li>
  <li><code>htmlmail.tpl.php</code></li>
</ul>
<p>The <code>$theme\_hook\_suggestions</code> variable contains an array of suggested <a href="http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7">theme</a> <a href="http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_theme/7">hooks</a>, in reverse priority order. For the above example, it would contain:</p>
<p>The <code>$template\_files</code> variable contains an array of suggested <a href="http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/6">theme</a> <a href="http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_theme/6">hooks</a>, in reverse priority order. For the above example, it would contain:</p>
<ul>
  <li><code>htmlmail</code></li>
  <li><code>htmlmail-example\_module</code></li>
  <li><code>htmlmail-example\_module\_outgoing</code></li>
  <li><code>htmlmail-example\_module\_outgoing\_message</code></li>
</ul>
<p>For another example, to customize the <a href="http://api.drupal.org/api/drupal/modules--user--user.pages.inc/function/user_pass_submit/7">password reset</a> emails sent by the <a href="http://api.drupal.org/api/drupal/modules--user--user.module/7">user module</a>, copy <code>htmlmail.tpl.php</code> to your theme directory, and also copy it to <code>htmlmail-user\_password\_reset.tpl.php</code>, then modify the latter file. Remember that you will need to put <em>both</em> files in your theme directory for this to work.</p>
<p>For another example, to customize the <a href="http://api.drupal.org/api/drupal/modules--user--user.pages.inc/function/user_pass_submit/6">password reset</a> emails sent by the <a href="http://api.drupal.org/api/drupal/modules--user--user.module/6">user module</a>, copy <code>htmlmail.tpl.php</code> to your theme directory, and also copy it to <code>htmlmail-user\_password\_reset.tpl.php</code>, then modify the latter file. Remember that you will need to put <em>both</em> files in your theme directory for this to work.</p>
<p>Template files are cached, so remember to clear the cache by visiting <em>admin/settings/performance</em> after creating, copying, or editing any <code>.tpl.php</code> files.</p>
<p>The following variables are also available in this template:</p>
<dl>
@@ -85,8 +85,8 @@ function htmlmail_admin_settings() {
    <p>The absolute URL to the theme directory.</p>
  </dd>
</dl>
<p>The module calling <a href="http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7">drupal_mail()</a> may set other variables. For instance, the <a href="http://drupal.org/project/webform">Webform module</a> sets a <code>$node</code> variable which may be very useful.</p>
<p>Other modules may also add or modify theme variables by implementing a <code>MODULENAME\_preprocess\_htmlmail()</code> <a href="http://api.drupal.org/api/drupal/modules--system--theme.api.php/function/hook_preprocess_HOOK/7">hook function</a>.</p>'
<p>The module calling <a href="http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/6">drupal_mail()</a> may set other variables. For instance, the <a href="http://drupal.org/project/webform">Webform module</a> sets a <code>$node</code> variable which may be very useful.</p>
<p>Other modules may also add or modify theme variables by implementing a <code>MODULENAME\_preprocess\_htmlmail()</code> hook function.</p>'
      // End instructions.
    ),
  );
+3 −5
Original line number Diff line number Diff line
name = HTML Mail
description = "Enables HTML in system emails."
dependencies[] = mailmime
dependencies[] = mailsystem
files[] = htmlmail.module
files[] = htmlmail.admin.inc
files[] = htmlmail.install
files[] = htmlmail.mail.inc
configure = admin/config/system/htmlmail
dependencies[] = echo
configure = admin/settings/htmlmail
package = Mail
core = 6.x
php = 5.0
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ function htmlmail_install() {
/**
 * Removes variables that are no longer used.
 */
function htmlmail_update_7200() {
function htmlmail_update_6200() {
  variable_del('htmlmail_header');
  variable_del('htmlmail_footer');
  variable_del('htmlmail_css');
+10 −11
Original line number Diff line number Diff line
When formatting an email message, Drupal determines the active template
directory by looking for `htmlmail.tpl.php` file in the following locations:

*    [path\_to\_theme()](http://api.drupal.org/api/drupal/includes--theme.inc/function/path\_to\_theme/7)
*    [drupal\_get\_path(](http://api.drupal.org/api/drupal/includes--common.inc/function/drupal\_get\_path/7)"module", [$installed\_profile](http://api.drupal.org/api/drupal/developer--globals.php/global/installed\_profile/7))
*    [drupal\_get\_path(](http://api.drupal.org/api/drupal/includes--common.inc/function/drupal\_get\_path/7)"module", ["htmlmail"](http://drupal.org/project/htmlmail))
*    [path\_to\_theme()](http://api.drupal.org/api/drupal/includes--theme.inc/function/path\_to\_theme/6)
*    [drupal\_get\_path(](http://api.drupal.org/api/drupal/includes--common.inc/function/drupal\_get\_path/6)"module", [$installed\_profile](http://api.drupal.org/api/drupal/developer--globals.php/global/installed\_profile/6))
*    [drupal\_get\_path(](http://api.drupal.org/api/drupal/includes--common.inc/function/drupal\_get\_path/6)"module", ["htmlmail"](http://drupal.org/project/htmlmail))

Once the active template directory is found, Drupal looks in that directory
for template files in order from most specific to most general.
@@ -21,9 +21,9 @@ the possible template file names would be:
*    `htmlmail-example\_module.tpl.php`
*    `htmlmail.tpl.php`

The `$theme\_hook\_suggestions` variable contains an array of suggested
[theme](http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7)
[hooks](http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook\_theme/7),
The `$template\_files` variable contains an array of suggested
[theme](http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/6)
[hooks](http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_theme/6),
in reverse priority order.  For the above example, it would contain:

*    `htmlmail`
@@ -32,9 +32,9 @@ in reverse priority order. For the above example, it would contain:
*    `htmlmail-example\_module\_outgoing\_message`

For another example, to customize the
[password reset](http://api.drupal.org/api/drupal/modules--user--user.pages.inc/function/user\_pass\_submit/7)
[password reset](http://api.drupal.org/api/drupal/modules--user--user.pages.inc/function/user_pass_submit/6)
emails sent by the
[user module](http://api.drupal.org/api/drupal/modules--user--user.module/7),
[user module](http://api.drupal.org/api/drupal/modules--user--user.module/6),
copy `htmlmail.tpl.php` to your theme directory, and also
copy it to `htmlmail-user\_password\_reset.tpl.php`, then modify the
latter file. Remember that you will need to put *both* files in your theme
@@ -68,11 +68,10 @@ The following variables are also available in this template:
:    The absolute URL to the theme directory.

The module calling
[drupal\_mail()](http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal\_mail/7)
[drupal\_mail()](http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal\_mail/6)
may set other variables.  For instance, the
[Webform module](http://drupal.org/project/webform)
sets a `$node` variable which may be very useful.

Other modules may also add or modify theme variables by implementing a
`MODULENAME\_preprocess\_htmlmail()`
[hook function](http://api.drupal.org/api/drupal/modules--system--theme.api.php/function/hook_preprocess_HOOK/7).
`MODULENAME\_preprocess\_htmlmail()` hook function.
+14 −18
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ function htmlmail_help($path, $arg) {
 * Implements hook_menu().
 */
function htmlmail_menu() {
  $items['admin/config/system/htmlmail'] = array(
  $items['admin/settings/htmlmail'] = array(
    'title' => 'HTML Mail',
    'description' => 'Configure HTML Mail system-wide settings.',
    'page callback' => 'drupal_get_form',
@@ -30,13 +30,13 @@ function htmlmail_menu() {
    'theme callback' => 'htmlmail_get_selected_theme',
    'file' => 'htmlmail.admin.inc',
  );
  $items['admin/config/system/htmlmail/settings'] = array(
  $items['admin/settings/htmlmail/settings'] = array(
    'title' => 'Settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'theme callback' => 'htmlmail_get_selected_theme',
    'weight' => '-2'
  );
  $items['admin/config/system/htmlmail/test'] = array(
  $items['admin/settings/htmlmail/test'] = array(
    'title' => 'Send Test',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('htmlmail_test_form'),
@@ -45,16 +45,6 @@ function htmlmail_menu() {
    'theme callback' => 'htmlmail_get_selected_theme',
    'file' => 'htmlmail.admin.inc',
  );
  // Callback that receives the message via $_POST and displays it on a themed
  // page.  This is used to format an email message with a Drupal theme.
  $items['admin/config/system/htmlmail/email'] = array(
    'title callback' => 'htmlmail_get_post_subject',
    'page callback' => 'htmlmail_show_email',
    'theme callback' => 'htmlmail_get_selected_theme',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
    'file' => 'htmlmail.admin.inc',
  );
  return $items;
}

@@ -166,6 +156,10 @@ function template_preprocess_htmlmail(&$variables) {
  foreach ($parts as $part) {
    $variables['theme_hook_suggestions'][] = $last .= '_' . $part;
  }
  foreach (module_implements('preprocess_htmlmail') as $module) {
    $function = $module . '_preprocess_htmlmail';
    $function($variables);
  }
}

/**
@@ -201,11 +195,13 @@ function htmlmail_form_user_profile_form_alter(&$form, &$form_state) {
}

/**
 * Implements hook_user_presave().
 * Implements hook_user().
 */
function htmlmail_user_presave(&$edit, $account, $category) {
function htmlmail_user($op, &$edit, $account, $category) {
  if ($op == 'submit') {
    $edit['data']['htmlmail_plaintext'] = empty($edit['htmlmail_plaintext']) ? 0 : 1;
  }
}

/**
 * Returns an associative array of allowed themes.  The keys are the
@@ -213,11 +209,11 @@ function htmlmail_user_presave(&$edit, $account, $category) {
 * Code shamelessly stolen from the og_theme module.
 */
function htmlmail_get_allowed_themes() {
  $allowed = &drupal_static(__FUNCTION__);
  static $allowed;
  if (!isset($allowed)) {
    $allowed = array('' => t('No theme'));
    module_load_include('inc', 'system', 'system.admin');
    $themes = list_themes();
    module_load_include('inc', 'system', 'system.admin');
    uasort($themes, 'system_sort_modules_by_info_name');
    foreach ($themes as $key => $value) {
      if ($value->status) {
Loading