You are here

function print_mail_requirements in Printer, email and PDF versions 5.4

Same name and namespace in other branches
  1. 7.2 print_mail/print_mail.install \print_mail_requirements()
  2. 7 print_mail/print_mail.module \print_mail_requirements()

Implementation of hook_requirements().

File

print_mail/print_mail.module, line 89

Code

function print_mail_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {
    case 'runtime':

      // If the input format used by mimemail includes the HTML filter or the line break converter filter, then warn the administrator of the incompatibility
      // in case that module's Use mime mail for all messages is set and the used input format would modify the sent e-mail
      if (module_exists('mimemail') && variable_get('mimemail_alter', 0)) {
        $format = variable_get('mimemail_format', FILTER_FORMAT_DEFAULT);
        $format = filter_resolve_format($format);
        $filters = filter_list_format($format);
        if (array_key_exists('filter/0', $filters) || array_key_exists('filter/2', $filters)) {
          $requirements['print_mail_mimemail'] = array(
            'title' => $t('Send by e-mail'),
            'value' => l($t('Mime Mail configuration'), 'admin/settings/mimemail'),
            'description' => $t("The current configuration of the Mime Mail module creates problems with the 'Send to Friend' function. Either disable Mime Mail's <em>Use mime mail for all messages</em> or disable the <em>HTML filter</em> and <em>Line break converter</em> filters in the input format used by that module (when the format is not selectable in that module's settings form, the default format is used)."),
            'severity' => REQUIREMENT_WARNING,
          );
        }
      }
      break;
  }
  return $requirements;
}