facets_range_nouislider-1.0.0/facets_range_nouislider.install
facets_range_nouislider.install
<?php
/**
* @file
* Contains install hooks for facets range widget.
*/
/**
* Implements hook_requirements().
*/
function facets_range_nouislider_requirements() {
$library_name = 'nouislider';
$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::service('extension.list.profile')->getPath($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_nouislider'] = [
'title' => t('Facets range slider'),
'value' => t('The noUiSlider 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;
}
