You are here

function autocomplete_deluxe_help in Autocomplete Deluxe 2.0.x

Same name and namespace in other branches
  1. 8 autocomplete_deluxe.module \autocomplete_deluxe_help()
  2. 7.2 autocomplete_deluxe.module \autocomplete_deluxe_help()

Implements hook_help().

@inheritdoc

File

./autocomplete_deluxe.module, line 15
The Autocomplete Deluxe module improves autocomplete fields using JQuery UI.

Code

function autocomplete_deluxe_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.autocomplete_deluxe':
      $text = file_get_contents(dirname(__FILE__) . "/README.txt");
      if (!\Drupal::moduleHandler()
        ->moduleExists('markdown')) {
        $output = '<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);
        $output = $filter
          ->process($text, 'en');
      }
      return $output;
  }
}