You are here

public static function Model::hook_help in Calendar Systems 8.2

Implementation of hook_help()

Parameters

$route_name:

\Drupal\Core\Routing\RouteMatchInterface $route_match:

Return value

string

1 call to Model::hook_help()
calendar_systems_help in ./calendar_systems.module

File

src/Model.php, line 18
This is where the module integrates with Drupal

Class

Model

Namespace

Drupal\calendar_systems

Code

public static function hook_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.calendar_systems':
      $text = file_get_contents(__DIR__ . '/README.md');
      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');
      }
    case 'calendar_systems.admin':
      $output = '<p>' . t('Using the following form you can assign a different calendar system to each language and also select the default calendar system.') . '</p>';
      return $output;
  }
}