summaryrefslogtreecommitdiffstats
path: root/gallery_help.inc
blob: 873c0be2696476556a2aab56f9b9ec9e95a0552e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php

/**
 * gallery.module : gallery_help.inc
 * Help and documentation
 */

/**
 * Implementation of hook_help().
 */
function _gallery_help($section) {
  switch ($section) {
    case 'filter#short-tip' :
      return gallery_help_filter_short_tip();
    case 'filter#long-tip' :
      return gallery_help_filter_long_tip();
    default:
      return '';
  }
}

/**
 * Function gallery_help_filter_short_tip().
 */
function gallery_help_filter_short_tip() {
  return t('You may link to Gallery2 items on this site <a href="@url">using a special syntax</a>.',
            array('@url' => url('filter/tips', array('fragment' => 'filter-gallery-0'))));
}

/**
 * Function gallery_help_filter_long_tip().
 */
function gallery_help_filter_long_tip() {
  $prefix = trim(variable_get('gallery_filter_prefix', 'G2')) .':';
  $path = drupal_get_path('module', 'gallery') .'/help/filter-gallery.html';
  
  $output  = '<p><strong>Gallery2 Filter:</strong> </p>';
  $output .= str_replace('PREFIX:', $prefix, file_get_contents($path));
  
  return $output;
}

/**
 * Function _gallery_report_help().
 */
function _gallery_report_help() {
  return t('<p><strong>A serious error has occured. This can happen due to an incorrect configuration or a bug in the
            gallery module. If you plan to submit a bug report to the issue queue at <a href="@gallery-issues">drupal.org</a>
            consider to include the <a href="@report">pre-generated report file</a>.</strong></p>',
            array(
              '@gallery-issues' => 'http://drupal.org/project/issues/gallery',
              '@report' => url('admin/settings/gallery/report/download'))
          );
}

/**
 * Function _gallery_advanced_help_get_form_help().
 */
function _gallery_advanced_help_get_form_help($form_id, $module = 'gallery') {
  static $form_help = NULL;

  if (!isset($form_help)) {
    $module_path = drupal_get_path('module', $module);
    if (file_exists("$module_path/help/$module.forms_help.ini")) {
      $info = parse_ini_file("./$module_path/help/$module.forms_help.ini", TRUE);
      foreach ($info["$module-forms"] as $form => $topic) {
        $form = explode('@', $form);
        $form_help[$form[1]][$form[0]] = $topic;
      }
    }
  }

  return isset($form_help[$form_id]) ? $form_help[$form_id] : array();
}