You are here

function ckeditor_iframe_requirements in CKEditor iFrame 8.2

Implements hook_requirements().

File

./ckeditor_iframe.install, line 11
CKEditor iFrame install file.

Code

function ckeditor_iframe_requirements($phase) {
  $requirements = [];
  if ($phase === 'install' || $phase === 'runtime') {
    $plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/iframe/plugin.js');
    if ($plugin_detected) {
      $requirements['ckeditor_iframe'] = [
        'title' => t('CKEditor iFrame'),
        'value' => t('Plugin detected'),
        'severity' => REQUIREMENT_OK,
      ];
    }
    else {
      $requirements['ckeditor_iframe'] = [
        'title' => t('CKEditor iFrame'),
        'value' => t('Plugin not detected'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('You must download the <a href=":plugin_url">CKEditor iFrame plugin</a> before enabling the CKEditor Iframe module. Place the plugin in the /libraries/iframe folder.', [
          ':plugin_url' => 'http://ckeditor.com/addon/iframe',
        ]),
      ];
    }
  }
  return $requirements;
}