mailjet-8.x-2.7/mailjet.install

mailjet.install
<?php

/**
 * @file
 * Install, update and uninstall functions for the Mailjet Module.
 */

/**
 * Implements hook_requirements().
 */
function mailjet_requirements($phase) {
  $requirements = [];

  if ($phase == 'install') {
    $errorData = [
      'severity' => REQUIREMENT_ERROR,
      'description' => t('Mailjet module requires the <a href="@phpmailer">PHPMailer Library</a>, which is missing. Download and extract the entire contents of the archive into the %path directory on your server.',
        [
          '@phpmailer' => 'https://github.com/PHPMailer/PHPMailer/archive/v6.0.7.zip',
          '%path' => 'libraries/phpmailer',
        ]
      ),
    ];

    if (file_exists('libraries/phpmailer/src/PHPMailer.php')) {
        require_once 'libraries/phpmailer/src/PHPMailer.php';
    } elseif (file_exists('../vendor/phpmailer/phpmailer/src/PHPMailer.php')) {
        require_once '../vendor/phpmailer/phpmailer/src/PHPMailer.php';
    } elseif (file_exists('vendor/phpmailer/phpmailer/src/PHPMailer.php')) {
        require_once 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
    } else {
        $requirements['phpmailer'] = $errorData;
    }
  }
  return $requirements;
}

/**
 * Implements hook_uninstall().
 */
function mailjet_uninstall() {
    $config = \Drupal::getContainer()
      ->get('config.factory')
      ->getEditable('system.mail');
    $config->set('interface.default', 'php_mail')->save();
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc