facets_range_widget.module in Facets 8
Contains install hooks for facets range widget.
File
modules/facets_range_widget/facets_range_widget.moduleView source
<?php
/**
* @file
* Contains install hooks for facets range widget.
*/
/**
* Implements hook_requirements().
*/
function facets_range_widget_requirements() {
$library_name = 'jquery-ui-slider-pips';
$library_path = '/libraries/' . $library_name;
$library_exists = file_exists(DRUPAL_ROOT . $library_path) ? TRUE : FALSE;
// If library is not found, look in the current profile libraries path.
if (!$library_exists) {
$profile = \Drupal::installProfile();
$profile_path = drupal_get_path('profile', $profile);
$profile_path .= $library_path;
$library_exists = file_exists($profile_path);
}
$requirements = [];
if (!$library_exists) {
$arguments = [
':docs' => 'https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme#external',
':readme' => 'http://cgit.drupalcode.org/facets/tree/modules/facets_range_widget/README.txt',
];
$requirements['facets_range_widget_pips_slider'] = [
'title' => t('Facets range slider'),
'value' => t('The jquery ui slider pips library is not installed.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The range slider library is not installed, check the <a href=":readme">README.txt for more information</a> and <a href=":docs">the documentation for information on how to install a library</a>.', $arguments),
];
}
return $requirements;
}
Functions
Name | Description |
---|---|
facets_range_widget_requirements | Implements hook_requirements(). |