You are here

function glyphicons_requirements in CKEditor Bootstrap Glyphicon 8

Implements hook_requirements().

File

./glyphicons.install, line 11
Check requirements for the CKEditor Bootstrap Glyphicon module.

Code

function glyphicons_requirements($phase) {
  $requirements = [];
  $path = \Drupal::service('library.libraries_directory_file_finder')
    ->find('glyphicons/plugin.js');
  if (!file_exists($path)) {
    $requirements['glyphicons'] = [
      'title' => t('CKEditor Bootstrap Glyphicon'),
      'value' => t('Plugin not detected'),
      'severity' => REQUIREMENT_ERROR,
      'description' => t('CKEditor Bootstrap Glyphicon requires the plugin.js
       library. Download the plugin from http://ckeditor.com/addon/glyphicons
       at least version 2.2, and place it in the libraries folder
       (/libraries/glyphicons)'),
    ];
  }
  else {
    $requirements['glyphicons'] = [
      'title' => t('CKEditor Bootstrap Glyphicong'),
      'value' => t('Plugin detected'),
      'severity' => REQUIREMENT_OK,
    ];
  }
  return $requirements;
}