You are here

function mailchimp_requirements in Mailchimp 8

Same name and namespace in other branches
  1. 7.5 mailchimp.install \mailchimp_requirements()
  2. 7.2 mailchimp.install \mailchimp_requirements()
  3. 7.3 mailchimp.install \mailchimp_requirements()
  4. 7.4 mailchimp.install \mailchimp_requirements()
  5. 2.x mailchimp.install \mailchimp_requirements()

Implements hook_requirements().

File

./mailchimp.install, line 13
Install, update and uninstall functions for the Mailchimp Module.

Code

function mailchimp_requirements($phase) {
  $requirements = [
    'mailchimp' => [
      'title' => t('Mailchimp'),
    ],
  ];
  if ($phase == 'runtime') {
    $config = \Drupal::config('mailchimp.settings');

    // Check for Mailchimp library.
    if (class_exists($config
      ->get('api_classname'))) {
      $requirements['mailchimp']['description'] = t('The Mailchimp MCAPI wrapper library is installed correctly.');
      $requirements['mailchimp']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['mailchimp']['description'] = t('The Mailchimp MCAPI wrapper library has not been installed correctly.');
      $requirements['mailchimp']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}