You are here

function ckeditor_bootstrap_buttons_requirements in CKEditor Bootstrap Buttons 2.0.x

Same name and namespace in other branches
  1. 8 ckeditor_bootstrap_buttons.install \ckeditor_bootstrap_buttons_requirements()

Implements hook_requirements().

File

./ckeditor_bootstrap_buttons.install, line 11
Install, requirements functions for the ckeditor_bootstrap_buttons module.

Code

function ckeditor_bootstrap_buttons_requirements($phase) {
  $requirements = [];
  $path = DRUPAL_ROOT . '/libraries/btbutton/plugin.js';
  if (\Drupal::moduleHandler()
    ->moduleExists('libraries')) {
    $path = libraries_get_path('btbutton') . '/plugin.js';
  }

  // Is the library found in the root libraries path.
  $library_found = file_exists($path);
  if (!$library_found) {
    $requirements['ckeditor_bootstrap_buttons'] = [
      'title' => t('CKEditor Bootstrap Buttons library missing'),
      'description' => t('CKEditor Bootstrap Buttons requires the btbutton library.
        Download it (https://github.com/smonetti/btbutton) and place it in the
        libraries folder (/libraries)'),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  return $requirements;
}