function panelbutton_requirements in CKEditor Panel Button 8
Implements hook_requirements().
File
- ./
panelbutton.install, line 11 - Contains update functions for Panel Button module.
Code
function panelbutton_requirements($phase) {
$requirements = [];
// @todo Remove backward compatibility conditions when we bump Drupal
// requirement to 8.9.0. See https://www.drupal.org/node/3099614
if (\Drupal::hasService('library.libraries_directory_file_finder')) {
/** @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder $library_file_finder */
$path = \Drupal::service('library.libraries_directory_file_finder')
->find('panelbutton/plugin.js');
}
else {
$path = DRUPAL_ROOT . '/libraries/panelbutton/plugin.js';
if (\Drupal::moduleHandler()
->moduleExists('libraries')) {
$path = libraries_get_path('panelbutton') . '/plugin.js';
}
}
if (!file_exists($path)) {
$requirements['panelbutton'] = [
'title' => t('Panelbutton library is missing'),
'value' => t('Plugin not detected'),
'severity' => REQUIREMENT_ERROR,
'description' => t('Panelbutton requires the plugin.js library.
Download the plugin from http://ckeditor.com/addon/panelbutton at least
version 4.5.6, and place it in the libraries folder
(/libraries/panelbutton)'),
];
}
else {
$requirements['panelbutton'] = [
'title' => t('CKEditor Panelbutton'),
'value' => t('Plugin detected'),
'severity' => REQUIREMENT_OK,
];
}
return $requirements;
}