You are here

function fakeobjects_requirements in CKEditor FakeObjects 8

Implements hook_requirements().

File

./fakeobjects.install, line 11
Check requirements for the FakeObjects module.

Code

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