Nodequeue and Views Combination.
Posted on: Tuesday, August 31st 2010 by Alla Solovyeva

Sometimes it is really hard to show only the needed nodes in the needed order using views only.
Here are some examples when you need to give a Content Manager (CM) some control over the nodes that will be displayed by the view:
- you need to promote on the front page some content Item (for ex., some new Game) and want the CM to be able to change it through the UI any time he pleased

- you need to show the newest Games in the block (sorted by some date), but you need to give the CM ability to override this list and show a couple of Games of their choice at the top of the list (following by rest of the newest Games sorted by a date)

- you need to show a list of Items of some Type, but to make sure that some of the Items (from some "black list") will never be included into this list.

The Nodequeue and Views modules will be a very useful combination here.

A nodequeue is basically a list of nodes that were added to it and saved in some particular order. When you create a new Nodequeue, you can choose how many nodes it can contain, who can add nodes, and which node type can be added. There are also some settings defining how to display tabs/links for maintaining relevant nodequeues from a node page.

If a node of some type can be added to any nodequeue, then besides the View and Edit tabs on the node page you will get an additional one - Nodequeue (this tab name can be changed in module settings). Here you can easily add/remove the node to/from all relevant nodequeues.

To use a nodequeue you need to add it to the view as a Relationships item. You can add a label that will be used in this view for your convenience (but, unfortunately, somewhere it will still be seen as "Nodequeue" without a name); can limit this relation to one or more queues. You can also set if this relationship is required or just optional for nodes to be displayed.

If you want to use a nodequeue as a 'black list' and exclude its content from the display, you can add this nodequeue into Filters (set Relationship to YourBlacklistQueueName and 'In Queue' to 'False').

I also want to remind you to be careful when you export a view with nodequeues in it: the queues ids will be hard coded in the exported code (the same way as taxonomy vocabularies), so make sure the nodequeues IDs you are using in some other database have the same IDs as the view you are trying to import.

Comments

Smart use of relationships, never combined these modules this way. Thanks for the tip :)

Nice approach, thanks for the tip.

Thanks a lot. I could learn about this. You have explained it very well with real time examples.

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.