You are here

function animate_css_requirements in Animate CSS 8

Same name and namespace in other branches
  1. 7 animate_css.install \animate_css_requirements()

Implements hook_requirements().

File

./animate_css.install, line 27
Requirements page for Animate Css.

Code

function animate_css_requirements($phase) {

  // Verify Animate is enabled.
  if ($phase == 'install') {
    return [];
  }
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('animate_css', 'animate');
  $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['css'][0]['data']);
  return [
    'animate_library_downloaded' => [
      'title' => t('Animate library'),
      'value' => $library_exists ? t('Installed') : t('Not installed'),
      'description' => $library_exists ? '' : t('The Animate library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/animate.css folder in your Drupal installation directory.', [
        '@url' => DOWNLOAD_URL,
      ]),
      'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    ],
  ];
}