You are here

HelpService.php in Bibliography & Citation 2.0.x

Same filename and directory in other branches
  1. 8 src/HelpService.php

Namespace

Drupal\bibcite

File

src/HelpService.php
View source
<?php

namespace Drupal\bibcite;


/**
 * Class HelpService.
 *
 * @package Drupal\bibcite
 */
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;
  }

}

Classes

Namesort descending Description
HelpService Class HelpService.