You are here

function easy_breadcrumb_help in Easy Breadcrumb 8

Same name and namespace in other branches
  1. 7.2 easy_breadcrumb.module \easy_breadcrumb_help()
  2. 2.x easy_breadcrumb.module \easy_breadcrumb_help()

Implements hook_help().

File

./easy_breadcrumb.module, line 13
The Easy Breadcrumb module improves the core system breadcrumbs.

Code

function easy_breadcrumb_help($route_name) {
  switch ($route_name) {
    case 'help.page.easy_breadcrumb':
      $text = file_get_contents(__DIR__ . "/README.md");

      // If the Markdown module is installed...
      if (\Drupal::moduleHandler()
        ->moduleExists('markdown') === TRUE) {

        // Uses the Markdown filter to render the README.
        $filter_manager = \Drupal::service('plugin.manager.filter');
        $settings = \Drupal::configFactory()
          ->get('markdown.settings')
          ->getRawData();
        $config = [
          'settings' => $settings,
        ];
        $filter = $filter_manager
          ->createInstance('markdown', $config);
        $output = $filter
          ->process($text, 'en');
      }
      else {

        // Outputs the README in plain text.
        $output = '<pre>' . $text . '</pre>';
      }

      // Adds a link to the Drupal.org documentation pages.
      $output .= t('<p>See the <a href=":documentation">documentation pages</a> on Drupal.org for more information.</p>', [
        ':documentation' => 'https://www.drupal.org/docs/8/improve-the-breadcrumbs',
      ]);
      return $output;
  }
}