You are here

function advanced_help_get_topic_file_info in Advanced Help 7

Same name and namespace in other branches
  1. 6 advanced_help.module \advanced_help_get_topic_file_info()

Load and render a help topic.

The strategy is first to see if a translated file for the current active language exists. If not found, look for the default.

2 calls to advanced_help_get_topic_file_info()
advanced_help_get_topic_filename in ./advanced_help.module
Load and render a help topic.
advanced_help_view_topic in ./advanced_help.module
Load and render a help topic.

File

./advanced_help.module, line 653
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function advanced_help_get_topic_file_info($module, $topic) {
  global $language;
  $info = advanced_help_get_topic($module, $topic);
  if (empty($info)) {
    return;
  }

  // Search paths:
  $module_type = _advanced_help_get_module_type($module);
  $paths = array(
    // First see if a translation exists.
    drupal_get_path($module_type, $module) . "/translations/help/{$language->language}",
    // In same directory as .inc file.
    $info['path'],
  );
  foreach ($paths as $path) {
    if (file_exists("{$path}/{$info['file']}")) {
      return array(
        'path' => $path,
        'file' => $info['file'],
      );
    }
  }
}