You are here

function mandrill_requirements in Mandrill 8

Same name and namespace in other branches
  1. 7.2 mandrill.install \mandrill_requirements()
  2. 7 mandrill.install \mandrill_requirements()

Implements hook_requirements()

File

./mandrill.install, line 46
Install, update, and uninstall functions for the mandrill module.

Code

function mandrill_requirements($phase) {
  $requirements = array(
    'mandrill' => array(
      'title' => t('Mandrill'),
    ),
  );
  if ($phase == 'runtime') {

    // Check for Mandrill library.
    if (class_exists('Mandrill')) {
      $requirements['mandrill']['description'] = t('The Mandrill library is installed correctly.');
      $requirements['mandrill']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['mandrill']['description'] = t('The Mandrill library has not been installed correctly.');
      $requirements['mandrill']['severity'] = REQUIREMENT_ERROR;
    }

    // Check for the Mail System module.
    if (\Drupal::moduleHandler()
      ->moduleExists('mailsystem')) {
      $requirements['mandrill']['description'] = t('The Mail System module is installed.');
      $requirements['mandrill']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['mandrill']['description'] = t('The Mail System module is required for Mandrill.');
      $requirements['mandrill']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}