I got a notice through ajax while using a Media enabled image field to upload and then edit an image. The notice was the following:

Notice: Undefined index: #theme in zen_menu_local_tasks() (line 547 of /path/to/zen/template.php).

The culprit seems to be this line in /zen/template.php:

if (isset($variables[$type][$key]['#theme']) && $variables[$type][$key]['#theme'] == 'menu_local_task' || is_array($variables[$type][$key]['#theme']) && in_array('menu_local_task', $variables[$type][$key]['#theme'])) {

You can see that isset($variables[$type][$key]['#theme']) should also be conditional for the second part of the OR operator, so I believe the solution is to put paranthesis and always check the isset :P:

if (isset($variables[$type][$key]['#theme']) && ($variables[$type][$key]['#theme'] == 'menu_local_task' || is_array($variables[$type][$key]['#theme']) && in_array('menu_local_task', $variables[$type][$key]['#theme']))) {

This fixed my issue. I'll attach a patch.

CommentFileSizeAuthor
undefined_index_theme.patch903 bytesdagomar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JohnAlbin’s picture

Title: Notice: Undefined index: #theme in zen_menu_local_tasks() » Fix undefined index notice in zen_menu_local_tasks()
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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