You are here

class HelpService in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x src/HelpService.php \Drupal\bibcite\HelpService

Class HelpService.

@package Drupal\bibcite

Hierarchy

Expanded class hierarchy of HelpService

1 string reference to 'HelpService'
bibcite.services.yml in ./bibcite.services.yml
bibcite.services.yml
1 service uses HelpService
bibcite.help_service in ./bibcite.services.yml
Drupal\bibcite\HelpService

File

src/HelpService.php, line 10

Namespace

Drupal\bibcite
View source
class HelpService implements HelpServiceInterface {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members