You are here

function ckeditor_readmore_help in CKEditor Read More 2.x

Same name and namespace in other branches
  1. 8 ckeditor_readmore.module \ckeditor_readmore_help()
  2. 7 ckeditor_readmore.module \ckeditor_readmore_help()

Implements hook_help().

File

./ckeditor_readmore.module, line 14

Code

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;
  }
}