? .DS_Store ? drupal7-feature_help-system.patch ? help.zip ? modules/.DS_Store ? modules/comment/.DS_Store ? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.808 diff -u -p -r1.808 common.inc --- includes/common.inc 12 Oct 2008 19:03:04 -0000 1.808 +++ includes/common.inc 13 Oct 2008 21:30:37 -0000 @@ -2895,6 +2895,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() { @@ -2961,8 +2979,8 @@ function drupal_common_theme() { 'item_list' => array( 'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL), ), - 'more_help_link' => array( - 'arguments' => array('url' => NULL), + 'help_link' => array( + '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.295 diff -u -p -r1.295 menu.inc --- includes/menu.inc 13 Oct 2008 12:30:09 -0000 1.295 +++ includes/menu.inc 13 Oct 2008 21:30:39 -0000 @@ -1229,8 +1229,8 @@ 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])); + if ($arg[0] == "admin" && help_exists($arg[2]) && $help) { + $output .= theme("help_link", $arg[2]); } } } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.438 diff -u -p -r1.438 theme.inc --- includes/theme.inc 12 Oct 2008 04:30:05 -0000 1.438 +++ includes/theme.inc 13 Oct 2008 21:30:40 -0000 @@ -1527,10 +1527,51 @@ function theme_item_list($items = array( } /** - * Returns code that emits the 'more help'-link. - */ -function theme_more_help_link($url) { - return ''; + * 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_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 ''; } /** Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.101 diff -u -p -r1.101 system.admin.inc --- modules/system/system.admin.inc 12 Oct 2008 04:30:08 -0000 1.101 +++ modules/system/system.admin.inc 13 Oct 2008 21:30:43 -0000 @@ -88,7 +88,6 @@ function system_admin_by_module() { $modules = module_rebuild_cache(); $menu_items = array(); - $help_arg = module_exists('help') ? drupal_help_arg() : FALSE; foreach ($modules as $file) { $module = $file->name; @@ -102,7 +101,7 @@ function system_admin_by_module() { if (count($admin_tasks)) { // Check for help links. - if ($help_arg && module_invoke($module, 'help', "admin/help#$module", $help_arg)) { + if (help_exists($module)) { $admin_tasks[100] = l(t('Get help'), "admin/help/$module"); } @@ -634,9 +633,6 @@ function system_modules($form_state = ar $modules = array(); $form['modules'] = array('#tree' => TRUE); - // Used when checking if module implements a help page. - $help_arg = module_exists('help') ? drupal_help_arg() : FALSE; - // Iterate through each of the modules. foreach ($files as $filename => $module) { $extra = array(); @@ -657,11 +653,9 @@ function system_modules($form_state = ar } } // Generate link for module's help page, if there is one. - if ($help_arg && module_hook($filename, 'help')) { - if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) { - // Module has a help page. - $extra['help'] = theme('more_help_link', url("admin/help/$filename")); - } + if (module_exists('help') && help_exists($filename)) { + // Module has a help page. + $extra['help'] = theme('help_link', $filename); } // Mark dependents disabled so user can not remove modules being depended on. $dependents = array();