In function template_preprocess_ad_gallery_formatter_ad_gallery_default node object is retrieved using nid from arg() and loading node. This is not needed as long as node object can be found in $vars['element']['#node']; also, this is a problem if you want to retrieve a full themed node with an AD Gallery using AJAX, because arg() returns the AJAX call path instead of the node path.

I've attachted a patch that resolves this issue just using $vars['element']['#node']. I'm using it in a website with AD Gallerys retrieved using AJAx and I've not detected any problem.

CommentFileSizeAuthor
ad_gallery_formatter_get_node.patch1015 bytestunic

Comments

maikeru’s picture

Status: Needs review » Reviewed & tested by the community

Ahah.

Your patch fixed my problem with errors appearing on paths that aren't 'node/#number' see: #1005150: warning: Invalid argument supplied for foreach() in ad_gallery.theme.inc when trying to add comment on full node view.

Thanks muchly :)