toc_js.install in Toc.js 2.0.x
Same filename and directory in other branches
Contains toc_js.install.
File
toc_js.installView source
<?php
/**
* @file
* Contains toc_js.install.
*/
/**
* Implements hook_requirements().
*/
function toc_js_requirements($phase) {
$requirements = [];
if ($phase != 'runtime') {
return $requirements;
}
// @todo: simplified when [#3093289] lands to keep dist folder only.
$library_path = '/libraries/toc/toc.min.js';
$library_exists = file_exists(DRUPAL_ROOT . $library_path) ? TRUE : FALSE;
if (!$library_exists) {
$library_path = '/libraries/toc/dist/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 (found in %path)', [
'%path' => $library_path,
]) : 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;
}
/**
* Force cache rebuild to register new library alter hook.
*/
function toc_js_update_8001() {
}
Functions
Name![]() |
Description |
---|---|
toc_js_requirements | Implements hook_requirements(). |
toc_js_update_8001 | Force cache rebuild to register new library alter hook. |