You are here

function jquery_calendar_requirements in jQuery World Calendars API 3.x

Same name and namespace in other branches
  1. 7 jquery_calendar.install \jquery_calendar_requirements()

Implements hook_requirements().

File

./jquery_calendar.install, line 23
Install, update and uninstall functions for the jquery_calendar module.

Code

function jquery_calendar_requirements($phase) {
  if ($phase !== 'runtime') {
    return [];
  }
  require_once __DIR__ . '/jquery_calendar.module';
  $library_exists = true;
  $message = '';
  try {
    jquery_calendar_requirements_check();
  } catch (\Drupal\jquery_calendar\Error\MissingRequirements $e) {
    $library_exists = false;
    $message = $e
      ->getMessage();
  }
  return [
    'jquery_calendar_library_downloaded' => [
      'title' => t('Jquery World Calendars library'),
      'value' => $library_exists ? t('Installed') : t('Not installed'),
      'description' => \Drupal\Core\Render\Markup::create($message),
      'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    ],
  ];
}