Download & Extend

Refactor nodequeue_nodes

Project:Nodequeue
Version:7.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I ran into a problem, working on a recent project: I wanted direct access to the node objects for a specific nodequeue, to make custom theming easier. The way it stands now, you must either use a view or accept the rendered output provided by nodequeue_nodes().

This patch is a small rewrite of nodequeue_nodes(). It adds a helper function, nodequeue_fetch_nodes(), which returns an ordered array of the node objects for a given queue.

AttachmentSizeStatusTest resultOperations
fetch_nodequeue_patch.diff2.46 KBIgnored: Check issue status.NoneNone

Comments

#1

Version:6.x-2.0-rc2» 7.x-2.x-dev

Here's a better version of this patch, which properly enables random fetching, and drops display-related arguments from the fetch function signature.

AttachmentSizeStatusTest resultOperations
fetch_nodequeue_patch2.diff4.62 KBIgnored: Check issue status.NoneNone

#2

This sounds reasonable to me . Thanks for the revised patch - I hope to review this soon,

#3

This is definitely useful, it would be great seeing this integrated into the next release.

#4

hope to review and commit this this coming weekend. It does need some rerolling by someone, possibly me, to remove the lowercase 'true' changes that are unrelated to this patch.

#5

Status:needs review» needs work

I finally got a chance to give this some attention.

The code here is solid but it seems like the function naming has the potential to be confusing. nodequeue_fetch_nodes returns loaded (but not rendered) node objects, while nodequeue_fetch_front, nodequeue_fetch_back and nodequeue_fetch_random return rendered node objects. Perhaps the fetch functions should be renamed nodequeue_load_front (and so on), nodequeue_nodes would then be renamed nodequeue_view_nodes, and nodequeue_fetch_nodes would become nodequeue_load_nodes. Then, when using the load (formerly fetch) functions, module developers could simple call node_view from within their modules.

What do you think?

Thanks for your interest and patience. I'll review any feedback (or rerolls) quicker this time ;).

#6

Status:needs work» fixed

I made those name changes and did the related refactoring. Committed. Thanks!

#7

Status:fixed» closed (fixed)

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