You are here

ckeditor_readmore.module in CKEditor Read More 2.x

Same filename and directory in other branches
  1. 8 ckeditor_readmore.module
  2. 7 ckeditor_readmore.module

File

ckeditor_readmore.module
View source
<?php

/**
 * Implements hook_preprocess_html().
 */
function ckeditor_readmore_preprocess_html(&$variables) {
  $variables['#attached']['library'][] = 'ckeditor_readmore/ckeditor_readmore';
}

/**
 * Implements hook_help().
 */
function ckeditor_readmore_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.ckeditor_readmore':
      $filepath = dirname(__FILE__) . '/README.md';
      if (file_exists($filepath)) {
        $readme = file_get_contents($filepath);
      }
      else {
        $filepath = dirname(__FILE__) . '/README.txt';
        if (file_exists($filepath)) {
          $readme = file_get_contents($filepath);
        }
      }
      if (!isset($readme)) {
        return NULL;
      }
      $output = '<pre>' . htmlspecialchars($readme) . '</pre>';
      return $output;
  }
}

Functions

Namesort descending Description
ckeditor_readmore_help Implements hook_help().
ckeditor_readmore_preprocess_html Implements hook_preprocess_html().