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.
When on the manage items page the following error occurs:
Strict warning: Only variables should be passed by reference in theme_node_gallery_api_sort_items_form() (line 232 of [..]node_gallery/theme/theme.inc).
This is because the result of a function (file_view() in this case) is being passed directly to drupal_render. The result of file_view() needs to be assigned to a variable first and that variable passed into drupal_render().
EDIT
The same also happens in theme_node_gallery_api_manage_items_form() around line 52.
Comment | File | Size | Author |
---|---|---|---|
#3 | node_gallery_strict_warnings_2050423_3.patch | 1.25 KB | zero2one |
Comments
Comment #1
clipps CreditAttribution: clipps commentedI encountered the same issue on the manage page and also on the upload new item tab.
Comment #2
llehotsky CreditAttribution: llehotsky commentedSame issue here. Appears also in beta-3 release.
I am relatively newbie to Drupal, so correct me if I'm wrong. Solved by putting
file_view((object) $file, 'node_gallery_api_admin_thumbnail')
fromdrupal_render(file_view((object) $file, 'node_gallery_api_admin_thumbnail'));
into separate variable and only then rendering it, as suggested in the original post.Hence code on line 59 of theme.inc changed from
to
Same principle applies to row 232, with the exception that variable has to be outside of array.
Comment #3
zero2one CreditAttribution: zero2one commentedI created a patch that fixes the strict warnings.
Comment #4
zengenuity CreditAttribution: zengenuity commentedLooks good. Committed. http://drupalcode.org/project/node_gallery.git/commit/c8b8697
Thanks for the patch!
Comment #5.0
(not verified) CreditAttribution: commentedUpdate to mention same error in theme_node_gallery_api_manage_items_form()