You are here

ckwordcount.install in CKEditor Wordcount 8

Same filename and directory in other branches
  1. 2.x ckwordcount.install

Ckeditor Word Count Module.

File

ckwordcount.install
View source
<?php

/**
 * @file
 * Ckeditor Word Count Module.
 */

/**
 * Implements hook_requirements().
 */
function ckwordcount_requirements($phase) {
  $requirements = [];
  if ($phase == 'install' || $phase == 'runtime') {
    $plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/wordcount/plugin.js') || file_exists(DRUPAL_ROOT . '/libraries/ckeditor-wordcount-plugin/wordcount/plugin.js');
    if ($plugin_detected) {
      $requirements['wordcount'] = [
        'title' => t('CKEditor Wordcount'),
        'value' => t('Plugin detected'),
        'severity' => REQUIREMENT_OK,
      ];
    }
    else {
      $requirements['wordcount'] = [
        'title' => t('CKEditor Wordcount'),
        'value' => t('Plugin not detected'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('You will need the CKEditor plugin for counting words and characters before enabling this module. <a href=":plugin_url">Get the plugin here</a>.', [
          ':plugin_url' => 'http://ckeditor.com/addon/wordcount',
        ]),
      ];
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
ckwordcount_requirements Implements hook_requirements().