You are here

function aos_requirements in Animate On Scroll 8

Same name and namespace in other branches
  1. 7 aos.install \aos_requirements()

Implements hook_requirements().

File

./aos.install, line 26
Library requirements for AOS.

Code

function aos_requirements($phase) {

  // Verify AOS is enabled.
  if ($phase == 'runtime') {
    $library = \Drupal::service('library.discovery')
      ->getLibraryByName('aos', 'aos_lib');
    $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['css'][0]['data']);
    return [
      'aos_library_downloaded' => [
        'title' => t('AOS library'),
        'value' => $library_exists ? t('Installed') : t('Not installed'),
        'description' => $library_exists ? '' : t('The AOS library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/aos folder in your Drupal installation directory.', [
          '@url' => 'https://github.com/michalsnik/aos/archive/master.zip',
        ]),
        'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      ],
    ];
  }
}