You are here

function _library_mail_text in Library 7

Same name and namespace in other branches
  1. 5.2 library.actions.inc \_library_mail_text()
  2. 6.2 library.module \_library_mail_text()
  3. 6 library.module \_library_mail_text()

Builds the text for overdue reminder emails.

Parameters

string $key: Message key (body or subject).

null $language: Desired language.

array $variables: Must contain patronname & site to display correctly for notify_overdue_subject and additionally !items for notify_overdue_body.

Return value

null|string Translated string for subject or body.

2 calls to _library_mail_text()
library_admin_settings_overdue in ./library.admin.inc
Menu callback: Edit Library Overdue Settings.
library_mail in ./library.actions.inc
Implements hook_mail().

File

./library.module, line 1506

Code

function _library_mail_text($key, $language = NULL, $variables = array()) {

  // @todo Consider separating template from logic here.
  $langcode = isset($language) ? $language->language : NULL;
  if ($admin_setting = variable_get('library_mail_' . $key, FALSE)) {

    // An admin setting overrides the default string.
    return strtr($admin_setting, $variables);
  }
  else {

    // No override, return default string.
    switch ($key) {
      case 'notify_overdue_subject':
        return t('Overdue Items for !patronname at !site', $variables);
      case 'notify_overdue_body':
        return t("!patronname,\n\nThank you for using !site. You have one or more items that are overdue. You can find a list of overdue items below. \n\n!items\n\nPlease return these items as soon as possible. \n\nThank you!", $variables);
    }
  }
}