You are here

function pagebreak_requirements in CKEditor PageBreak 8

Implements hook_requirements().

File

./pagebreak.install, line 11
Check requirements for the PageBreak module.

Code

function pagebreak_requirements($phase) {
  $requirements = [];
  if ($phase == 'install' || $phase == 'runtime') {
    $plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/pagebreak/plugin.js');
    if ($plugin_detected) {
      $requirements['pagebreak'] = [
        'title' => t('PageBreak'),
        'value' => t('Plugin detected'),
        'severity' => REQUIREMENT_OK,
      ];
    }
    else {
      $requirements['pagebreak'] = [
        'title' => t('PageBreak'),
        'value' => t('Plugin not detected'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('Before you can use the PageBreak module, you need to download the plugin from ckeditor.com and place it in /libraries/pagebreak. Check the README.txt for more information. <a href=":plugin_url">Get the plugin here</a>.', [
          ':plugin_url' => 'http://ckeditor.com/addon/pagebreak',
        ]),
      ];
    }
  }
  return $requirements;
}