You are here

ckeditor_iframe.install in CKEditor iFrame 8.2

CKEditor iFrame install file.

File

ckeditor_iframe.install
View source
<?php

/**
 * @file
 * CKEditor iFrame install file.
 */

/**
 * Implements hook_requirements().
 */
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;
}

Functions