You are here

ckeditor_bootstrap_buttons.install in CKEditor Bootstrap Buttons 8

Same filename and directory in other branches
  1. 2.0.x ckeditor_bootstrap_buttons.install

Install, requirements functions for the ckeditor_bootstrap_buttons module.

File

ckeditor_bootstrap_buttons.install
View source
<?php

/**
 * @file
 * Install, requirements functions for the ckeditor_bootstrap_buttons module.
 */

/**
 * Implements hook_requirements().
 */
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;
}

Functions