You are here

function amp_requirements in Accelerated Mobile Pages (AMP) 7

Same name and namespace in other branches
  1. 8.3 amp.install \amp_requirements()
  2. 8 amp.install \amp_requirements()
  3. 8.2 amp.install \amp_requirements()

Implements hook_requirements().

File

./amp.install, line 11
Contains amp.install.

Code

function amp_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    if (!class_exists('\\Lullabot\\AMP\\AMP')) {
      $requirements['amp_library'] = array(
        'title' => t('AMP'),
        'value' => t('Not available'),
        'description' => t('The AMP module requires the PHP <a href="@library">AMP library</a>. Install using <a href="@composer_manager">composer manager</a>', array(
          '@library' => 'https://github.com/Lullabot/amp-library',
          '@composer_manager' => 'https://www.drupal.org/project/composer_manager',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    if (!module_exists('token')) {
      $requirements['amp_token'] = array(
        'title' => t('Token module required for AMP'),
        'value' => t('Not installed'),
        'description' => t('The AMP module requires the <a href="@module">Token</a> module as a dependency. Please download and install Token to prevent errors with AMP.', array(
          '@module' => 'https://www.drupal.org/project/token',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    if (!module_exists('ctools')) {
      $requirements['amp_ctools'] = array(
        'title' => t('ctools module required for AMP'),
        'value' => t('Not installed'),
        'description' => t('The AMP module requires the <a href="@module">ctools</a> module as a dependency. Please download and install ctools to prevent errors with AMP.', array(
          '@module' => 'https://www.drupal.org/project/ctools',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    $themes = list_themes();
    if (empty($themes['amptheme']) || empty($themes['amptheme']->status)) {
      $requirements['amptheme'] = array(
        'title' => t('AMP Base Theme'),
        'value' => t('Not installed'),
        'description' => t('The AMP module requires the <a href="@theme">AMP Base Theme</a> to be installed.', array(
          '@theme' => 'https://www.drupal.org/project/amptheme',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}