If you go to the help page of a module that doesn't have any administration pages, you'll get the heading of '@module administration pages' and then no more. (See admin/help/color for an example.)

I see two ways to address this problem:

  1. If there are no administration pages, show a text ("None", "No pages", "This modules doesn't have any administration pages.", etc.).
        $admin_tasks = system_get_module_admin_tasks($name);
        if (empty($admin_tasks)) {
          $admin_tasks[] = t('This module does not have any adminstration pages.');
        }
        else {
          ksort($admin_tasks);
        }
        $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
    
  2. Simply hide the '@module administration pages' header.
        $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'])));
        }
    

I'm not sure which approach I like better, so please chime in! (FTR, both provided code examples have been tested and worked at the time of this writing.)

Comments

Freso’s picture

Status: Active » Needs review
StatusFileSize
new972 bytes

Having thought a bit more on it, I've come to prefer option 2. There is no need to show the "administration pages" header at all, if there's nothing to administer. It'll only add clutter and thus possible confusion to the help page. The code is cleaner, too. :)

Patch attached.

JirkaRybka’s picture

Status: Needs review » Reviewed & tested by the community

I totally agree, there's no point in showing empty lists, and dummy messages are unnecessary too...

The patch applies cleanly, works as expected, and is simple enough for me to say that it looks OK. So setting RTBC.

Freso’s picture

Assigned: Unassigned » Freso

Also, when this has been committed to D6, I'll port it to D5 as I've noticed the same behaviour there, and the fix is most likely just simple. :)

Freso’s picture

StatusFileSize
new963 bytes

Actually, just for the hell of it: Here's the patch for Drupal 5! (To whomever commits this: Please change version to D5 and status to "Patch (CNR)". Thank you.)

gábor hojtsy’s picture

Version: 6.x-dev » 5.x-dev
Status: Reviewed & tested by the community » Needs review

Thanks, committed to Drupal 6.x.

drumm’s picture

Status: Needs review » Fixed

Committed to 5.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)