You are here

sidr.install in Sidr: Accessible Mobile Menus 8

Same filename and directory in other branches
  1. 8.3 sidr.install
  2. 8.2 sidr.install

Install and uninstall hooks for the sidr module.

File

sidr.install
View source
<?php

/**
 * @file
 * Install and uninstall hooks for the sidr module.
 */

/**
 * Implements hook_requirements().
 */
function sidr_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }

  // Sidr libraries must be installed.
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('sidr', 'sidr');
  $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['js'][0]['data']);
  return [
    'sidr_library_downloaded' => [
      'title' => t('Sidr library'),
      'value' => $library_exists ? t('Installed') : t('Not installed'),
      'description' => $library_exists ? '' : t('The Sidr library needs to be downloaded. See the README file in the module for instructions.'),
      'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    ],
  ];
}

Functions

Namesort descending Description
sidr_requirements Implements hook_requirements().