Verified Commit cecdd293 authored by apaderno's avatar apaderno
Browse files

Improved the requirement messages

parent b7217f3d
......@@ -2,38 +2,41 @@
/**
* @file
* Install, update, and uninstall functions for CKEditor Advanced Tab.
* Install, update and uninstall hooks for the CKEditor Advanced Tab module.
*/
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Implements hook_requirements().
*/
function ckeditor_advanced_tab_requirements($phase) {
$requirements = [];
if ($phase == 'install' || $phase == 'runtime') {
$path = '/libraries/ckeditor/plugins/dialogadvtab/';
$plugin_detected = file_exists(DRUPAL_ROOT . $path . 'plugin.js');
$path = DRUPAL_ROOT . '/libraries/ckeditor/plugins/dialogadvtab/';
$t_args = [':plugin_url' => 'https://ckeditor.com/cke4/addon/dialogadvtab', ':directory' => $path];
if ($plugin_detected) {
if (file_exists($path . 'plugin.js')) {
$requirements['dialogadvtab'] = [
'title' => t('CKEditor Advanced Tab'),
'value' => t('Plugin detected'),
'title' => new TranslatableMarkup('Advanced Tab for Dialogs'),
'value' => new TranslatableMarkup('Found'),
'description' => new TranslatableMarkup(
'The <a href=":plugin_url">Advanced Tab for Dialogs</a> plugin required from the <em>CKEditor Advanced Tab</em> module has been copied in the correct directory.',
$t_args
),
'severity' => REQUIREMENT_OK,
];
}
else {
$requirements['dialogadvtab'] = [
'title' => t('CKEditor Advanced Tab'),
'value' => t('Plugin not detected'),
'title' => new TranslatableMarkup('Advanced Tab for Dialogs'),
'value' => new TranslatableMarkup('Not found'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The CKEditor plugin <b>Dialog Advanced Tab</b> is
required. Download <a href=":url">here</a> and copy to
<code>:path</code>.', [
':url' => 'https://ckeditor.com/cke4/addon/dialogadvtab',
':path' => $path,
]),
'description' => new TranslatableMarkup(
'The <a href=":plugin_url">Advanced Tab for Dialogs</a> plugin required from the <em>CKEditor Advanced Tab</em> module has not been found. Download it and copy it in the %directory directory.',
$t_args
),
];
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment