I imagine this is a common use case.
I need to create a number of nodequeues, however.. I need more fields than just the title. Unfortunately I don't seem to be able to have multiple queues all use the same view by default.
So what I have taken to doing is actually hackign the nodequeue.views_default.inc to generate the views the way I want them.
It would be nice to somehow only have to set up your view once and be done with it.
Comments
Comment #1
merlinofchaos commentedIt seems like what you should do is:
1) Turn off nodequeue's default views
2) Create your own version of the code to create your default views instead. I would probably use different view names so you don't accidentally conflict.
Alternatively you could use hook_views_data_alter() to modify the nodequeue default views as you need.
It doesn't seem, to me at least, to be logical to allow this to be altered from within nodequeue. The whole point is that the default views it provides are a guide. They are customizable by the Views UI and the fact that you need to repeat teh customizations creates an edge case desire for convenience.
Comment #2
gdoteof commented1) I don't see where to do that in the UI? There is an option to not create a view for each nodequeue
"Automatically create one view per queue
Nodequeue can create a view for each queue. If you wish to have fewer views, you can disable this option and use a single view with an argument for the qid."
Unchecking that actually made some of my nodequeue blocks disappear (but not all of them??).
2) This is basically what I've done, but I don't know how to do this the 'correct' way, I guess. How do I tell nodequeue to use my code instead of it's default, other than by actually hacking the nodequeue.views_default.inc ?
I am going to be using these nodequeues primarily as blocks, with multiple blocks on the same page, using the same view and theme settings for each of the different nodequeues.
Will nodequeue somehow make a new block display for each nodequeue it creates within a single view.. or how does that work?
Thanks for your time/help.
Comment #3
ezra-g commentedIf you want an individual view for each queue and are familiar with the views API, you can as you have suggested code something up. Otherwise, if you are willing to pass arguments to a view, you can use single view that takes arguments. Or, you could create one view with multiple displays that don't take arguments.
Having a custom default view seems contratictary to me but I would review a patch to accomplish this.
Comment #4
ezra-g commentedComment #5
gdoteof commentedI don't necessarily want an individual view for each queue, though I am familiar with the views api.
However, what I've done is very hackish, and I will have to manually rollback the one file i've hacked if/when another release comes out and we upgrade.
In any case, I still am left with questions from #2
How do you 'use a single view that takes arguments' if I want to have multiple blocks, all using the same view, but displaying different nodequeues on any given number of pages? This would be ideal, but it doesn't really seem to straight forward.
Would I create a custom module that watches as a new nodequeue is created and creates a block with the nodequeue's ID as an argument? Is there another way to do this?
Maybe I should take a step back and ask for more general advice on exactly what it is I am trying to do. We are using nodequeues to set up a few regions on landing pages. All of these regions are formatted the same, they just have different lists of nodes. How would I best / most simply / most efficiently go about minimizing the amount of work that needs to be done each time a new queue is created?
Comment #6
henrijs.seso commentedI think it would be cool to provide default view that could be cloned and selected in options (then original disabled). My usecase is simple, I just want to change block admin title to Nodequeue title and remove page display. If I do that to clone and choose it in Nodequeue settings, I am a happy man. For now Im too busy, but if anyone is interested, I could make patch. Please ask so I know if this is important.
Comment #7
c4rl commentedSubscribing
Comment #8
jaron commentedI'm not sure but it sounds like that (#6) would be super helpful to me.
I'm trying to make it so that when I build a new simple queue, the view that is built is automatically setup like my modified nodequeue views. My modified nodequeue views are changed to a fields row style with specific fields already enabled and a page display with a menu link based on the queue's title. Is that possible? Any pointers? I have tried hacking the nodequeue.views_default.inc file and only broke the site, and I don't know enough php to use hook_views_data_alter(). If someone could guide me in the right direction it would be much appreciated.
Thanks!