You are here

function entityconnect_help in Entity connect 8.2

Implements hook_help().

File

./entityconnect.module, line 16
Contains entityconnect.module.

Code

function entityconnect_help($route_name, RouteMatchInterface $route_match) {
  $module_path = drupal_get_path('module', 'entityconnect');
  switch ($route_name) {

    // Main module help for the entityconnect module.
    case 'help.page.entityconnect':
      $output = '';
      $filepath = $module_path . '/README.md';
      if (file_exists($filepath)) {
        $readme = file_get_contents($filepath);
      }
      if (!isset($readme)) {
        return NULL;
      }
      if (\Drupal::moduleHandler()
        ->moduleExists('markdown')) {
        $filters = \Drupal::moduleHandler()
          ->invoke('markdown', 'filter_info');
        $info = $filters['filter_markdown'];
        if (function_exists($info['process callback'])) {
          $output = $info['process callback']($readme, NULL);
        }
        else {
          $output = '<pre>' . $readme . '</pre>';
        }
      }
      else {
        $output = '<pre>' . $readme . '</pre>';
      }
      return $output;
    default:
  }
}