You are here

function responsivewrappers_help in Responsive wrappers 8

Same name and namespace in other branches
  1. 2.0.x responsivewrappers.module \responsivewrappers_help()

Implements hook_help().

@inheritdoc

File

./responsivewrappers.module, line 15
Module file for responsivewrappers.

Code

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

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