Next/previous NID fields
| Project: | DraggableViews |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | won't fix |
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.
| Attachment | Size |
|---|---|
| navigation_fields.patch | 100.49 KB |

#1
Great, sounds very useful :)
I think you can use -w flag to ignore all white spaces.
cvs diff -wup file.inc#2
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.
#3
Mmm. Not sure if this shouldn't be the job of a separate module.