Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
undefined_index_theme.patch | 903 bytes | dagomar |
Comments
Comment #1
JohnAlbinYou're right!
Thanks! Fixed in http://drupalcode.org/project/zen.git/commitdiff/d61ee97