You are here

function zurb_twentytwenty_requirements in ZURB TwentyTwenty 8

Same name and namespace in other branches
  1. 7 zurb_twentytwenty.install \zurb_twentytwenty_requirements()
  2. 2.0.x zurb_twentytwenty.install \zurb_twentytwenty_requirements()

Implementation of hook_requirements().

Parameters

$phase:

Return value

array

File

./zurb_twentytwenty.install, line 11

Code

function zurb_twentytwenty_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'install':
    case 'runtime':
      $file_exists = file_exists(DRUPAL_ROOT . '/libraries/twentytwenty/js/jquery.twentytwenty.js');
      if ($file_exists) {
        $message = t('Zurb TwentyTwenty plugin detected in %path', [
          '%path' => '/libraries/twentytwenty.',
        ]);
      }
      else {
        $message = t('The Zurb TwentyTwenty plugin was not found. Please <a href=":repository_url" target="_blank">download it</a> into the libraries folder in the root (/libraries/twentytwenty).', [
          ':repository_url' => 'https://github.com/zurb/twentytwenty',
        ]);
      }
      $requirements['zurb_twentytwenty'] = [
        'title' => t('ZURB TwentyTwenty Plugin'),
        'value' => $message,
        'severity' => $file_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      ];
      break;
  }
  return $requirements;
}