? .DS_Store ? drupal7-feature_help-system.patch ? includes/.DS_Store ? modules/.DS_Store ? modules/help ? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.799 diff -u -p -r1.799 common.inc --- includes/common.inc 20 Sep 2008 20:22:23 -0000 1.799 +++ includes/common.inc 22 Sep 2008 19:39:50 -0000 @@ -2893,6 +2893,24 @@ function element_children($element) { } /** + * Determine whether help topics for a given module exist. + * + * @param $module + * The name of the module (without the .module extension). + * @return + * TRUE if the help module is installed & enabled and the given module provides help topics. + */ +function help_exists($module) { + if (drupal_function_exists('help_get_topics') && module_exists($module)) { + $topics = help_get_topics(); + return isset($topics[$module]); + } + else { + return; + } +} + +/** * Provide theme registration for themes across .inc files. */ function drupal_common_theme() { @@ -2960,7 +2978,7 @@ function drupal_common_theme() { 'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL), ), 'more_help_link' => array( - 'arguments' => array('url' => NULL), + 'arguments' => array('module' => NULL, 'topic' => NULL, 'title' => 'More help', 'popup' => NULL, 'attributes' => NULL), ), 'xml_icon' => array( 'arguments' => array('url' => NULL), Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.291 diff -u -p -r1.291 menu.inc --- includes/menu.inc 20 Sep 2008 20:22:23 -0000 1.291 +++ includes/menu.inc 22 Sep 2008 19:39:53 -0000 @@ -1228,7 +1228,7 @@ function menu_get_active_help() { // Add "more help" link on admin pages if the module provides a // standalone help page. if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) { - $output .= theme("more_help_link", url('admin/help/' . $arg[2])); + $output .= theme("more_help_link", $arg[2]); } } } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.437 diff -u -p -r1.437 theme.inc --- includes/theme.inc 20 Sep 2008 20:22:23 -0000 1.437 +++ includes/theme.inc 22 Sep 2008 19:39:55 -0000 @@ -1199,6 +1199,54 @@ function theme_help() { } /** + * Returns code that emits a 'more help' link with an icon, to view the topic, optionally in a popup. + * + * @param $module + * The module that owns this help topic. + * @param $topic + * Optional identifier for the topic. + * @param $title + * Optional title or label for the link. Default is "More help". + * @param $popup + * Optional boolean value to open the link in a popup. + * @param $attributes + * An array of attributes to include in hyperlink. + */ + function theme_more_help_link($module, $topic = NULL, $title = 'More help', $popup = TRUE, $attributes = array()) { + if (module_exists('help')) { + static $js_added = FALSE; + if ($popup) { + $popup_class = !empty($attributes['class']) ? $attributes['class'] . ' help-link-popup' : 'help-link-popup'; + // Set a class for links to be opened in a popup; degrades in the absence of JS. + $attributes += array('class' => $popup_class); + } + + // Fetch the topic information. + drupal_function_exists('help_get_topic'); + $info = help_get_topic($module, $topic); + + // Return empty is the specified topic doesn't exist. + if (isset($topic) && !$info) { + return; + } + + // Set the topic title as hyperlink title attribute. + $attributes += array('title' => $info['title']); + + if (!$js_added) { + // Include the javascript for launching popup for hyperlinks with class 'help-link-popup'. + drupal_add_js('modules/help/help.js', 'module'); + $js_added = TRUE; + } + } + + // Trim the trailing slash if no topic is specified. + $output = l(t($title), trim("admin/help/$module/$topic", '/'), array('attributes' => $attributes)); + + return '