I was able to make this happen in the 6x version without too much difficulty. It's eluding me here, though I can see the tools for it in theme_node_gallery_api_item_navigator within theme.inc
and an implementation in node-gallery-api-item-navigator.tpl.php
I'm using a zen subtheme based on the new responsive Zen. I've tried using display suite, creating ds-1col--file-image-node-gallery-file-display.tpl.php and wrapping the content in shorthand cribbed from the navigator, thus:
<?php print isset($next_link) ? '<a href="'. $next_link .'"> >' : ' '; ?>
<?php print $ds_content; ?>
<?php print '</a>' ?>No dice. The errors that my endless variations upon this approach generate I've been unable to understand or remedy, but I'm uncertain it would work even if I got the syntax right. Is this the right general ballpark approach, or is there something I'm missing in the configuration stages at the level of file or node? I'd appreciate any suggestions or responses, particularly those that can accommodate for my limited competence with php.
Update: If I were able to find/create a token for the "next-image" function, I could plug that into a linked field in the Node Gallery Item content type- totally open to that approach, too. After a few mostly fruitless days begging for help here and on IRC, I'm a little confounded.
Thanks in advance for your patience and understanding.
Comments
Comment #1
sodome2 commentedThis is not my strength, to put it mildly.
Haven't managed to properly define a .tpl file that the images will listen to, most recent attempts being
node--node-gallery-item-type--node-gallery-file-display.tpl.php
and
node-gallery-file-display.tpl.php
The function in node gallery api that seems relevant is
function node_gallery_api_get_next_item($ngid, $nid, $reset = FALSE) {
return node_gallery_api_seek_from_current_item($ngid, $nid, 1, $reset);
}
Currently trying to build a custom token with which to fill a linked field in the content type for Node Gallery Item. Long way 'round? You betcha. Also tried inserting queries cribbed from Devel into a token. This worked mechanically, but the queries are specific to a particular node.
return node_gallery_api_get_next_item ($data['node:node_gallery_gallery_nid'], $data['node:nid'])as a custom token doesn't look or feel right. Itgenerates 3 notices of undefined indexes, 1 notice of trying to get the property of a non object., and produces a "1" rather than a link. I understand the one to mean something like "Yes, that function exists."
I'd welcome input to this or any other approach.
Comment #2
sodome2 commentedVery helpful consultant (found on IRC #drupal-consultants, if I remember correctly) showed me the right template (node--node-gallery-item.tpl.php).
He inserted a function in the template.php that apparently displays on all pages of the site a list of possible hooks that can be addressed by templates. (This may also be an option in Devel's settings?)
(As is probably obvious, "mysubthemename" needs to be replaced by your own subthemeneame.)
Having found the right template to alter, there were still Initially some difficulties with template-based approaches (because links auto-closed regardless of posting format) and difficulties with complex or compound tokens failing and generating a bunch of errors when inserted in the linked field node gallery media of the node gallery item content type editing page for "full content".
While the consultant was otherwise occupied I spent some time trying to walk the line between being a productively squeaky wheel and being a stalker, asking for further support on twitter and elsewhere (with ub-optimal or zero responses, depending on venue).
I pledge to document the process and results for other users when I get this working, including the processes by which I locate support/resources. Learning lots along the way.
Comment #3
sodome2 commentedTremendous thanks to consultant Alessandro Feijó whose solution to this was affordable, elegant, and happened in three blindingly fast bursts over a couple days.
I mention the time period as a marked contrast to results from every other method by which I've sought support:
SO:
install Linked Field module.
Go to the edit area for your your content type (in my case Node Gallery Item at /admin/structure/types/manage/node-gallery-item/display.)
Select Custom display settings, and use the checkbox to enable custom settings for the display mode you want to link to next image. In my case, that is "Full content".
Select that display mode (/admin/structure/types/manage/node-gallery-item/display/full).
Click the cog icon at the far right of the field you want to behave as a link (I chose Gallery Media, rendered file, Node Gallery File Display), and select the checkbox for "link this field".
In the box beneath, enter "next-id". This is a placeholder. It could probably also read "replace-me-please". Save the display.
In your theme folder you may have a templates subfolder or your custom templates may float free. In my case, it's a subtheme of Zen, in which I have a templates folder. Alessandro deduced (by the magic of displaying available hooks?) that the name for our template needed to be "node--node-gallery-item.tpl.php". I created it in this folder, copying directly from Zen's node.tpl.php.
In that template file, the original line that displays whatever's in the node (in this case our picture) is
print render($content);Alessandro replaced that "insert content here", statement with "look for our placeholder in the content, replace it with the node-appropriate next page ID as url (as determined using bits of the Node Gallery navigator), copy it back into content, *then* insert content here."
With that change made, save the new .tpl.php file, rebuild the theme registry and clear caches. The images in your full display image gallery nodes should now link to next with the gallery.
Comment #4
sodome2 commentedComment #5.0
(not verified) commentedupdated as time passes...
Comment #6
sodome commentedYears later, I'm still using and appreciating node gallery and still using this solution devised by Alessandro Feijó. There may be a simpler fix involving the linked field module and tokens, but I haven't found it yet.
2 minor modifications I've made to the snippet are reflected below. I removed the trailing "#node-$next_id" (we'd appended it to the URL for testing) and added an "if empty" option so that when after the last item in a gallery there is no "next" link, clicking the image directs users to the topmost containing node gallery, which in my case is called "pictures." You could replace this with cleaner code calling to the top-level or containing gallery by function rather than name, or with the name of your own gallery. Any sloppiness introduced by these changes is mine, not Mr. Feijo's. Suggestions welcome.