You are here

ckeditor_codemirror.install in CKEditor CodeMirror 7

Same filename and directory in other branches
  1. 8.2 ckeditor_codemirror.install
  2. 8 ckeditor_codemirror.install

Install, update and uninstall functions for the CKEditor CodeMirror module.

File

ckeditor_codemirror.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the CKEditor CodeMirror module.
 */

/**
 * Implements hook_requirements().
 */
function ckeditor_codemirror_requirements($phase) {
  if ($phase != 'runtime') {
    return array();
  }
  $return = array();

  // Ensure translations don't break at install time.
  $t = get_t();

  // If the library is installed.
  if (($library = libraries_detect('ckeditor.codemirror')) && !empty($library['installed'])) {
    $return['ckeditor_codemirror_library'] = array(
      'title' => $t('CKEditor CodeMirror'),
      'severity' => REQUIREMENT_OK,
      'value' => $t('CKEditor CodeMirror plugin %version installed at %path.', array(
        '%path' => $library['library path'],
        '%version' => $library['version'],
      )),
    );
  }
  else {
    $return['ckeditor_codemirror_library'] = array(
      'title' => $t('CKEditor CodeMirror'),
      'severity' => REQUIREMENT_ERROR,
      'value' => $t('CKEditor CodeMirror plugin was not found. Download <a href="@link">the latest version of library</a> and place it in the libraries directory (sites/all/libraries/ckeditor.codemirror).', array(
        '@link' => 'https://github.com/w8tcha/CKEditor-CodeMirror-Plugin/releases',
      )),
    );
  }
  return $return;
}

Functions