You are here

function aos_install in Animate On Scroll 8

Implements hook_install().

File

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

Code

function aos_install() {

  // Check for AOS Library.
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('aos', 'aos_lib');
  $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['css'][0]['data']);
  if (!$library_exists) {
    $download_url = 'https://github.com/michalsnik/aos/archive/master.zip';
    $message = t('Animate On Scroll module requires the AOS library. <a href=":aos_lib_link">Download AOS library</a> and unzip into /libraries/aos.', [
      ':aos_lib_link' => $download_url,
    ]);
    $messenger = \Drupal::messenger();
    $messenger
      ->addMessage($message, 'warning');
  }
}