I am trying to embed an image gallery in a "Bike" custom content type using a node reference field. I have changed the "Display Field" settings of the node reference field to display the gallery as a teaser when the Bike is viewed as a teaser, and a full node when viewing the full bike node. However, the node gallery is shown as a teaser both when viewing the bike as a teaser and when viewing the full bike node.
See the attached image. This is on a clean Drupal 6.15 install with only Views, CCK, Admin Menu, and Node Gallery and its related modules installed.

CommentFileSizeAuthor
#5 teaser.patch1.78 KBjustintime
#3 teaser_fix.patch580 bytesjergason
problem.png99.43 KBjergason

Comments

AdrianC-1’s picture

Status: Needs work » Active

I think this is similar to what I'm seeing using Views_Slideshow. Within the Views edit, the only vaguely image field I can see is Node Gallery Image:Image - which is always the node_gallery_thumbnail version, no matter whether teaser or gallery is selected as the Image List View Mode.

jergason’s picture

Status: Active » Needs work

I implemented a quick and dirty fix by changing some code in the module. In the function _node_gallery_gallery_view on line 292 of node_galler.module there is a big switch statement that checks if the $page variable is set or not. If it is set, it will display the node as a node, and if $page is not set, then it defaults to the teaser.

$page is true if the node is to display in a full page state, which means that it is the main content of a page, not displayed in a view or another node. If the node is displayed in a view or in another node through node reference fields, then $page will be false and _node_gallery_gallery_view will render the node as a teaser, even when you want it to display as a full node.

My dirty hack was to change this on line 294:

if ($page) {

to this:

if ($page || !$teaser) {

This means that if the node is displayed as a node if $page is true, or if $teaser is false - ie in a view or node reference field that is set to display the full node. I am still learning how to do patches, so I will whip one together and post it on here to see if it works.

jergason’s picture

Version: 6.x-2.0-alpha12 » 6.x-2.0-beta2
Status: Active » Needs review
StatusFileSize
new580 bytes

This still appears to be a problem in 6.x-2.0-beta2. Here is my patch that fixes it. Don't know if it broke anything else though.

justintime’s picture

Wow. Learn something new every day.
http://api.drupal.org/api/function/node_view/6

Keying on $a4 from nodeapi isn't what we want to do. There's other areas in the module where this happens, so I'll fix it up.

BTW: I hope you're not using the patch from #3, you missed the '!' character. :)

justintime’s picture

StatusFileSize
new1.78 KB

Attached is a patch that replaces all checks for $page from nodeapi to check for !$teaser. Testing is appreciated.

justintime’s picture

Status: Needs review » Fixed

Committing this to dev so it can get some testing and get included in the next beta release.

Status: Fixed » Closed (fixed)

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