Problem/Motivation
When using the workbench_moderation module and clicking the 'unpublish this revision' link, a warning appears above the confirmation form.
Warning message:
Warning: Invalid argument supplied for foreach() in media_gallery_menu_local_tasks_alter() (line 177 of /srv/drupal/shortbread/releases/201111230942/sites/all/modules/changed/media_gallery/media_gallery.module).
Steps to reproduce
- Enable workbench_moderation module
- Create a gallery with moderation state published
- Click the 'unpublish this revision' link
- See the warning appear when the confirmation form is shown.
Proposed resolution
Make sure that there are local tasks present before looping through them by adding a check for this in media_gallery_menu_local_tasks_alter()
Comment | File | Size | Author |
---|---|---|---|
#3 | media_gallery-fix-empty-tabs-1351592-3.patch | 724 bytes | Moloc |
#1 | media-gallery-warning-invalid-argument-1351592-1.patch | 844 bytes | c31ck |
Comments
Comment #1
c31ck CreditAttribution: c31ck commentedCreated a patch that checks if $tabs is an array before looping through it.
Comment #2
c31ck CreditAttribution: c31ck commentedComment #3
Moloc CreditAttribution: Moloc commentedI can confirm the warning.
Attaching another patch with less code. It just replaces your added code
&& isset($data['tabs'][0]['output']) && is_array($data['tabs'][0]['output'])
with
&& !empty($data['tabs'])
Comment #4
lsolesen CreditAttribution: lsolesen commentedCommitted Moloc's patch.