You are here

codesnippet.install in CKEditor CodeSnippet 8

Check requirements for the CKEditor CodeSnippet module.

File

codesnippet.install
View source
<?php

/**
 * @file
 * Check requirements for the CKEditor CodeSnippet module.
 */

/**
 * Implements hook_requirements().
 */
function codesnippet_requirements($phase) {
  $requirements = [];
  if ($phase == 'install' || $phase == 'runtime') {
    $plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/codesnippet/plugin.js');
    if ($plugin_detected) {
      $requirements['codesnippet'] = [
        'title' => t('CodeSnippet'),
        'value' => t('Plugin detected'),
        'severity' => REQUIREMENT_OK,
      ];
    }
    else {
      $requirements['codesnippet'] = [
        'title' => t('CodeSnippet'),
        'value' => t('Plugin not detected'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('Before you can use the CKEditor CodeSnippet module, you need to download the codesnippet plugin from ckeditor.com and place it in /libraries/codesnippet. Check the README.txt for more information. <a href=":plugin_url">Get the plugin here</a>.', [
          ':plugin_url' => 'http://ckeditor.com/addon/codesnippet',
        ]),
      ];
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
codesnippet_requirements Implements hook_requirements().