Steps to replicate issue:

  1. Install Drupal using the standard profile
  2. drush dl ctools heartbeat-7.x-1.x
  3. drush en heartbeat_defaults -y
  4. navigate to admin/structure

Notice: Undefined offset: 5 in _menu_translate() (line 771 of /home/pieter/v/drupal/drupal/includes/menu.inc).

Note that this only occurs when field_ui is enabled and heartbeat_ui is disabled.

This is caused by admin paths being defined in heartbeat_entity_info() while the UI is switched off.

Looking through the issue queue I saw many reports of this notice. It is an indication that something is wrong with the menu routing, but it may manifest itself in many different ways. I'll write down why the notice was shown in this case, hopefully it can benefit someone.

In heartbeat_entity_info() an admin path is defined for every template using a wildcard for the template name. A number of menu items are then generated by field_ui_menu() (the 'Display' tab and secondary tabs for view modes). All tabs have a parent page where they are intended to be shown (this page is the 'tab_root'). This is handled by _menu_router_build(). Unfortunately the right parent page (admin/structure/heartbeat/templates) does not exist because the module that provides it is disabled, so the tab_root is set to the nearest existing parent: admin/structure.

Now when you visit admin/structure, menu_local_tasks() will gather the tabs to show on this page and will pass them to _menu_translate() together with a path mapping which is incomplete because it is based on the wrong tab_root. When _menu_translate() then tries to retrieve the wildcard in the path it cannot do so because the mapping for the wildcard doesn't exist. Then you get the notice :)

The reason in this case is that local tasks are defined through hook_entity_info() (in $entities['bundles']['admin']), but no parent menu item was available to show the local tasks on.

CommentFileSizeAuthor
#1 1548242-1-heartbeat-notice.patch1.24 KBpfrenssen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen’s picture

Status: Active » Needs review
FileSize
1.24 KB
Stalski’s picture

Status: Needs review » Fixed

True again. Also patched and pushed to git.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.