You are here

oauth2_client.module in OAuth2 Client 8.3

Holds hooks for the OAuth2 Client module.

File

oauth2_client.module
View source
<?php

/**
 * @file
 * Holds hooks for the OAuth2 Client module.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function oauth2_client_help($route_name, RouteMatchInterface $route_match) {
  if ($route_name === 'help.page.oauth2_client') {
    $readme_content = file_get_contents(__DIR__ . '/README.md');
    if (\Drupal::moduleHandler()
      ->moduleExists('markdown')) {

      // Use the Markdown filter to render the README.
      $filter_manager = \Drupal::service('plugin.manager.filter');
      $markdown_config = \Drupal::configFactory()
        ->get('markdown.settings')
        ->getRawData();
      $markdown_settings = [
        'settings' => $markdown_config,
      ];

      /** @var \Drupal\markdown\Plugin\Filter\MarkdownFilterInterface $filter */
      $filter = $filter_manager
        ->createInstance('markdown', $markdown_settings);
      return $filter
        ->process($readme_content, 'en');
    }
    else {
      return [
        '#type' => 'html_tag',
        '#tag' => 'pre',
        '#value' => $readme_content,
      ];
    }
  }
}

Functions

Namesort descending Description
oauth2_client_help Implements hook_help().