You are here

toc_js.install in Toc.js 8

Same filename and directory in other branches
  1. 2.0.x toc_js.install

Contains toc_js.install.

File

toc_js.install
View source
<?php

/**
 * @file
 * Contains toc_js.install.
 */

/**
 * Implements hook_requirements().
 */
function toc_js_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $requirements = [];
  $library_path = '/libraries/toc/toc.min.js';
  $library_exists = file_exists(DRUPAL_ROOT . $library_path) ? TRUE : FALSE;
  $requirements['toc_js_library_downloaded'] = [
    'title' => t('TOC.js library'),
    'value' => $library_exists ? t('Installed') : t('Not installed'),
    'description' => $library_exists ? '' : t('The TOC.js library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/toc folder in your Drupal installation directory. The complete path to the library must be <b>/libraries/toc/toc.min.js</b>.', [
      '@url' => 'https://github.com/jgallen23/toc/tree/greenkeeper/update-all',
    ]),
    'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
  ];
  return $requirements;
}

Functions

Namesort descending Description
toc_js_requirements Implements hook_requirements().