You are here

function feeds_para_mapper_help in Feeds Paragraphs 8

Same name and namespace in other branches
  1. 7 feeds_para_mapper.module \feeds_para_mapper_help()

Implements hook_help().

File

./feeds_para_mapper.module, line 12
Allows mapping to Paragraphs fields.

Code

function feeds_para_mapper_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.feeds_para_mapper':
      $filepath = dirname(__FILE__) . '/README.md';
      if (file_exists($filepath)) {
        $readme = file_get_contents($filepath);
      }
      else {
        $filepath = dirname(__FILE__) . '/README.txt';
        if (file_exists($filepath)) {
          $readme = file_get_contents($filepath);
        }
      }
      if (!isset($readme)) {
        return NULL;
      }
      $moduleHandler = Drupal::moduleHandler();
      if ($moduleHandler
        ->moduleExists('markdown')) {
        $filters = $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;
  }
}