Skip to content
Snippets Groups Projects
Select Git revision
  • 6dd28cafed3bb7efe736aff1c7a273621e632b64
  • 11.x default protected
  • 11.2.x protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

help.admin.inc

Blame
  • user avatar
    #191246 by domasj: sort module help pages by display name, not file name
    Gábor Hojtsy authored
    6dd28caf
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    help.admin.inc 2.20 KiB
    <?php
    // $Id$
    
    /**
     * @file
     * Admin page callbacks for the help module.
     */
    
    /**
     * Menu callback; prints a page listing a glossary of Drupal terminology.
     */
    function help_main() {
      // Add CSS
      drupal_add_css(drupal_get_path('module', 'help') .'/help.css', 'module', 'all', FALSE);
      $output = '<h2>'. t('Help topics') .'</h2><p>'. t('Help is available on the following items:') .'</p>'. help_links_as_list();
      return $output;
    }
    
    /**
     * Menu callback; prints a page listing general help for a module.
     */
    function help_page($name) {
      $output = '';
      if (module_hook($name, 'help')) {
        $module = drupal_parse_info_file(drupal_get_path('module', $name) .'/'. $name .'.info');
        drupal_set_title($module['name']);
    
        $temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
        if (empty($temp)) {
          $output .= t("No help is available for module %module.", array('%module' => $module['name']));
        }
        else {
          $output .= $temp;
        }
    
        // Only print list of administration pages if the module in question has
        // any such pages associated to it.
        $admin_tasks = system_get_module_admin_tasks($name);
        if (!empty($admin_tasks)) {
          ksort($admin_tasks);
          $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
        }
    
      }
      return $output;
    }
    
    function help_links_as_list() {
      $empty_arg = drupal_help_arg();
      $module_info = module_rebuild_cache();
    
      $modules = array();
      foreach (module_implements('help', TRUE) as $module) {
        if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
          $modules[$module] = $module_info[$module]->info['name'];
        }
      }
      asort($modules);
    
      // Output pretty four-column list
      $count = count($modules);
      $break = ceil($count / 4);
      $output = '<div class="clear-block"><div class="help-items"><ul>';
      $i = 0;
      foreach ($modules as $module => $name) {
        $output .= '<li>'. l($name, 'admin/help/'. $module) .'</li>';
        if (($i + 1) % $break == 0 && ($i + 1) != $count) {
          $output .= '</ul></div><div class="help-items'. ($i + 1 == $break * 3 ? ' help-items-last' : '') .'"><ul>';
        }
        $i++;
      }
      $output .= '</ul></div></div>';
    
      return $output;
    }