You are here

public function HelpService::getHelpMarkup in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 src/HelpService.php \Drupal\bibcite\HelpService::getHelpMarkup()

Get help text from file.

Overrides HelpServiceInterface::getHelpMarkup

File

src/HelpService.php, line 15

Class

HelpService
Class HelpService.

Namespace

Drupal\bibcite

Code

public function getHelpMarkup($links, $route, $module) {
  $module_path = drupal_get_path('module', $module);
  $lang = \Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId();
  $def = \Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId();
  $path = $module_path . '/help/' . $lang . '/' . $route . 'html';
  if ($def === $lang || !file_exists($path)) {
    $path = $module_path . '/help/default/' . $route . '.html';
  }
  if (file_exists($path)) {
    $output = file_get_contents($path);
    return sprintf($output, $links);
  }
  return NULL;
}