You are here

votingapi_widgets.install in Votingapi Widgets 8

Installation actions for Voting API Widgets.

File

votingapi_widgets.install
View source
<?php

/**
 * @file
 * Installation actions for Voting API Widgets.
 */

/**
 * 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;
}

Functions