You are here

ckeditor_codemirror.module in CKEditor CodeMirror 7

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

Main code for CKEditor CodeMirror module.

File

ckeditor_codemirror.module
View source
<?php

/**
 * @file
 * Main code for CKEditor CodeMirror module.
 */

/**
 * Implements hook_libraries_info().
 */
function ckeditor_codemirror_libraries_info() {
  $libraries['ckeditor.codemirror'] = array(
    'name' => 'CKEditor CodeMirror plugin',
    'vendor url' => 'https://w8tcha.github.io/CKEditor-CodeMirror-Plugin',
    'download url' => 'https://github.com/w8tcha/CKEditor-CodeMirror-Plugin/releases',
    'version arguments' => array(
      'file' => 'plugin.js',
      'pattern' => '@version:\\s+[\'\\"]{0,1}([0-9a-zA-Z\\.-]+)[\'\\"]{0,1}@',
    ),
    'files' => array(
      'js' => array(
        'plugin.js',
        'js/codemirror.min.js',
      ),
      'css' => array(
        'css/codemirror.min.css',
      ),
    ),
    'variants' => array(
      'minified' => array(
        'files' => array(
          'js' => array(
            'js/codemirror.min.js',
          ),
          'css' => array(
            'css/codemirror.min.css',
          ),
        ),
      ),
      'source' => array(
        'files' => array(
          'js' => array(
            'js/codemirror.js',
          ),
          'css' => array(
            'css/codemirror.css',
            'css/codemirror.ckeditor.css',
          ),
        ),
      ),
    ),
  );
  return $libraries;
}

/**
 * Implements hook_ckeditor_plugin().
 */
function ckeditor_codemirror_ckeditor_plugin() {
  return array(
    'codemirror' => array(
      'name' => 'codemirror',
      'desc' => t('CodeMirror (Source) Syntax Highlighting. See !addon_page for more details.', array(
        '!addon_page' => l(t('addon page'), 'http://ckeditor.com/addon/codemirror'),
      )),
      'path' => base_path() . libraries_get_path('ckeditor.codemirror') . '/',
    ),
  );
}