You are here

function search_api_attachments_help in Search API attachments 8

Same name and namespace in other branches
  1. 7 search_api_attachments.module \search_api_attachments_help()
  2. 9.0.x search_api_attachments.module \search_api_attachments_help()

Implements hook_help().

File

./search_api_attachments.module, line 66
Implement hooks and help functions to delete extracted files cache content.

Code

function search_api_attachments_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.search_api_attachments':
      $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');
      }
  }
  return NULL;
}