function ckeditor_uploadimage_requirements in CKEditor Upload Image 8
Same name and namespace in other branches
- 8.2 ckeditor_uploadimage.install \ckeditor_uploadimage_requirements()
Implements hook_requirements().
File
- ./
ckeditor_uploadimage.install, line 13 - Install file for the CKEditor Upload Image module.
Code
function ckeditor_uploadimage_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
$plugins = [
'uploadimage' => t('CKEditor Upload Image plugin'),
'uploadwidget' => t('CKEditor Upload Widget plugin'),
'filetools' => t('CKEditor File Tools plugin'),
'notification' => t('CKEditor Notification plugin'),
'notificationaggregator' => t('CKEditor Notification Aggregator plugin'),
];
/** @var \Drupal\Core\File\FileSystem $filesystem */
$filesystem = \Drupal::service('file_system');
$dir = $filesystem
->realpath('');
foreach ($plugins as $plugin => $label) {
$path = "libraries/ckeditor/plugins/{$plugin}/plugin.js";
if (!$filesystem
->realpath($path) && !$filesystem
->realpath("profiles/" . drupal_get_profile() . "/{$path}")) {
$requirements[$plugin . '_ckeditor_plugin'] = [
'description' => t('CKEditor Upload Image module requires the @plugin. Download,
extract and place the contents in %path', [
'@plugin' => Link::fromTextAndUrl($label, Url::fromUri("http://ckeditor.com/addon/{$plugin}"))
->toString(),
'%path' => "{$dir}/libraries/ckeditor/plugins/{$plugin}",
]),
'severity' => REQUIREMENT_ERROR,
];
}
}
}
return $requirements;
}