You are here

function cas_help in CAS 2.x

Same name and namespace in other branches
  1. 8 cas.module \cas_help()
  2. 5.4 cas.module \cas_help()
  3. 5 cas.module \cas_help()
  4. 5.3 cas.module \cas_help()
  5. 6.3 cas.module \cas_help()
  6. 6 cas.module \cas_help()
  7. 6.2 cas.module \cas_help()
  8. 7 cas.module \cas_help()

Implements hook_help().

File

./cas.module, line 288
Provides CAS authentication for Drupal.

Code

function cas_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.cas':
      $text = file_get_contents(dirname(__FILE__) . '/README.md');
      if (!\Drupal::moduleHandler()
        ->moduleExists('markdown')) {
        return '<pre>' . $text . '</pre>';
      }
      else {

        // Use the Markdown filter to render the README.

        /** @var \Drupal\filter\FilterPluginManager $filter_manager */
        $filter_manager = \Drupal::service('plugin.manager.filter');
        $settings = \Drupal::configFactory()
          ->get('markdown.settings')
          ->getRawData();
        $config = [
          'settings' => $settings,
        ];
        $filter = $filter_manager
          ->createInstance('markdown', $config);
        return $filter
          ->process($text, 'en');
      }
    default:
      return NULL;
  }
}