You are here

function jquery_calendar_requirements_check in jQuery World Calendars API 3.x

Return value

array|bool

Throws

\Drupal\jquery_calendar\Error\MissingRequirements

3 calls to jquery_calendar_requirements_check()
Demo::buildForm in src/Form/Demo.php
Form constructor.
jquery_calendar_requirements in ./jquery_calendar.install
Implements hook_requirements().
Settings::buildForm in src/Form/Settings.php
Form constructor.

File

./jquery_calendar.module, line 12
Implements necessary hooks, API and helpers for jQuery World Calendars.

Code

function jquery_calendar_requirements_check() {
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('jquery_calendar', 'jquery_calendars.core');
  $library_exists = false;
  if ($library) {
    $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['js'][0]['data']);
  }
  if (!$library_exists) {
    throw new \Drupal\jquery_calendar\Error\MissingRequirements(t('The Jquery Calendar library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/jquery_calendar folder in your Drupal installation directory.', [
      '@url' => 'http://keith-wood.name/calendars.html',
    ]));
  }
  return true;
}