You are here

jquery_calendar.install in jQuery World Calendars API 3.x

Same filename and directory in other branches
  1. 7 jquery_calendar.install

Install, update and uninstall functions for the jquery_calendar module.

File

jquery_calendar.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the jquery_calendar module.
 */
use Drupal\Core\Url;

/**
 * Implements hook_install().
 */
function jquery_calendar_install() {
  \Drupal::messenger()
    ->addMessage(t('Thanks for installing Jquery Calendar'));
  \Drupal::messenger()
    ->addMessage(t('You may configure Jquery Calendar by visiting <a href="@url_settings">@url_settings</a>', [
    '@url_settings' => Url::fromRoute('jquery_calendar.settings')
      ->toString(),
  ]));
}

/**
 * Implements hook_requirements().
 */
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,
    ],
  ];
}

Functions