You are here

function popup_dialog_help in Popup Dialog 8.2

Same name and namespace in other branches
  1. 8 popup_dialog.module \popup_dialog_help()

Implements hook_help().

File

./popup_dialog.module, line 15
Contains popup_dialog.module..

Code

function popup_dialog_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the popup_dialog module.
    case 'help.page.popup_dialog':
      $text = file_get_contents(dirname(__FILE__) . "/README.txt");
      if (!\Drupal::moduleHandler()
        ->moduleExists('markdown')) {
        return '<pre>' . $text . '</pre>';
      }
      else {

        // Use 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);
        return $filter
          ->process($text, 'en');
      }
      break;
    default:
  }
}