Issue with Admin Menu and default Drupal admin UI

kreynen's picture

In the 2.x branch of the modules, we've added a number of admin level configuration options. We've also added a permission level to manage each feature set without having to grant admin access. To streamline the UI, we've added Manage Equipment and Manage Scheduling sections to the /admin and well as a section for Open Media System. This structure translates well for sites using the Admin Menu module and saves us time writing UI for managing different parts of the system.

So what's the problem? In other modules that create these admin sections like og, there is a "parent" module that creates the section before the secondary menus are loaded into the section. The Open Media modules are structure is different in that some locations would start with om_project. Others might use om_show without om_project. If a module with a secondary menu with a path like admin/openmedia/om-timeslot-scheduler is loaded before admin/openmedia is created, it doesn't show up in Drupal's default /admin and creates it's own top level menu item in the admin menu module.

I discovered this when I reloaded om_project with a different weight. Instead of having 7 items under Open Media System, there were 6 additional items in the admin menu. No amount of cache clearing, menu rebuilding, or update.php'ing solved the problem. The only way I found to fix the problem was to disable and re-enable each module with an orphaned admin menu item. No need to reinstall, but it looks like the function that checks for a parent section in the admin menu is only called during the module activation process. The long term fix would be to identify that function and add a admin section rebuild button somewhere. Because I don't have time to do that right now, I'm posting this and adding the admin section to all 3 of the modules that could potentially be loaded first. This code has been added to om_show, om_project, and om_timeslot_scheduler

  // Adds Open Media Section to Admin Interface
  // Duplicated in om_show, om_project
  $items['admin/openmedia'] = array(
    'title' => 'Open Media System',
    'description' => 'Administration and configuration options for Open Media System.',
    'position' => 'right',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array('administration Open Media System'),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
    'weight' => -20,
  );

I don't think duplicating this in multiple modules causes any problems, but until someone writes the rebuild option it should help users who upgrade from 1.x to 2.x... which you shouldn't do until the 2.x branches become the supported versions. That will likely happen near the end of May.

AttachmentSize
adminmenu_issue.png368.42 KB

Open Media Project

Group categories

Audience

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: