v1/web/modules/contrib/votingapi_widgets/votingapi_widgets.install

28 lines
945 B
PHP

<?php
/**
* @file
* Install, update and uninstall functions for the votingapi_widgets module.
*/
/**
* Implements hook_requirements().
*/
function votingapi_widgets_requirements($phase) {
$requirements = [];
if ($phase === 'runtime') {
$path = \Drupal::root() . '/libraries/jquery-bar-rating';
$exists = is_file($path . '/dist/jquery.barrating.min.js');
$requirements['jquery_bar_rating'] = [
'title' => t('jquery-bar-rating'),
'description' => $exists ? '' : t('The <a href=":url">jQuery Bar Rating Plugin</a> should be installed at <strong>/libraries/jquery-bar-rating/dist/jquery.barrating.min.js</strong>. Check out file or folder permissions if troubled.', [':url' => 'https://github.com/antennaio/jquery-bar-rating']),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? t('Installed') : t('Not installed'),
];
}
return $requirements;
}