Next/previous NID fields

davideads - June 3, 2009 - 17:34
Project:DraggableViews
Version:6.x-3.x-dev
Component:Code
Category:feature request
Priority:minor
Assigned:Unassigned
Status:won't fix
Description

DraggableViews rocks -- it handles the whole node ordering problem as well as anything I've seen. I definitely hope I have time to hack on this in the next few months.

I wrote a patch that provides fields that return the next or previous NID in non-hierarchical DraggableViews sequences that use the native ordering handler. I'm creating a Views + DraggableViews image gallery, and wanted to provide "next" and "previous" links on a page view that displays one image node at a time.

Two issues with the patch:

I cleaned up extraneous DOS line endings and a few other things in the source (I was working in my local Mercurial repo) and I'm not quite sure how to splice that out of the patch. I'm going to try and roll a nicer patch ASAP.

The other thing is that I am a big dummy when it comes to the Views API, and getting this to work was very much a stab in the dark on my part. I asked merlin about how to accomplish this yesterday in IRC and he said to put the logic for determining the adjacent NIDs in the field handler's pre_render() or render() member functions.

Seems a bit ugly, but despite the caveats (it only supports the native order handler, only reliably works on flat lists), my implementation does seem functional.

AttachmentSize
navigation_fields.patch100.49 KB

#1

sevi - June 3, 2009 - 19:22

Great, sounds very useful :)

I think you can use -w flag to ignore all white spaces.

cvs diff -wup file.inc

#2

davideads - June 4, 2009 - 15:06

Sweet! You learn something new every day.

Also, I realized I also need to attach the new field handler's class definition, since I can't add it to CVS.

AttachmentSize
navigation_fields_06042009_1.patch 3.62 KB
views_handler_field_draggableviews_navigation_inc.txt 627 bytes

#3

sevi - July 9, 2009 - 21:21
Status:active» won't fix

Mmm. Not sure if this shouldn't be the job of a separate module.

 
 

Drupal is a registered trademark of Dries Buytaert.