function votingapi_widgets_requirements in Votingapi Widgets 8
Implements hook_requirements().
File
- ./
votingapi_widgets.install, line 11 - Installation actions for Voting API Widgets.
Code
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;
}