How to pass taxonomy term from node context and to embedded view?
First, thanks to Earl and Sam for Panels 2 - an amazing contribution to Drupal! I'm having a ball with it, but have hit a roadblock that has me stymied for the moment:
I want to make a panel page that takes a node id (or a path alias) as argument, and displays the content of that node in one pane, while extracting the top taxonomy term from the node, and passing the taxonomy term as an argument to some views panes in the same panel page.
Here's a diagram of what I mean:
Path: article/nid or article/path-alias +----------------------------------------------+----------------------------+ | | | |Article headline | more in International | | | (view filters on Business | | (term: Business) ------------------------------> term) | | | - link to article 1 | | article body.... | - link to article 2 | | | - link to article 3 | | | | +----------------------------------------------+----------------------------+
Here's the steps I've tried:
- create a view that filters by a taxonomy argument
- make a panel pane from that view
- make a panel page (2-column)
- under Context/Arguments, add "Node ID"
- under Context/Relationships, add "Term from Node" and select the vocabulary I want
- under Content, in the left panel, add "Node Content" from "Node Context"
- under Content, in the right panel, add the view pane I want
What I can't figure out is how to pass the Term context into the embedded view so it filters properly. Can Panels 2 do this?
If anyone could help, it would break a major logjam I'm having on my site. Thanks in advance!


Your view should filter by
Your view should filter by taxonomy tid.
Your panel pane for that view should be set to require a taxonomy term context for your view.
Otherwise, what you suggest should work.
Wow, that is just the piece
Wow, that is just the piece I needed - terrific! Amazing fast answer that has made my week.
Here's a small follow-up: Before you gave me the key to this, I was trying by putting the term id as a path argument to the panel, not using any contexts, and just passing that argument to the embedded views.
The views were set to Default: "display all values", and the views pane argument source was set to: "from panel argument."
While this didn't let me override display of specific nodes (which you've solved for me,) it did one great thing: if the category argument was absent, the views panes would still display, unfiltered (which is what I want).
With this new context approach, if the context is not present (e.g. the displayed node has no terms,) those embedded views don't display at all (because I imagine the "required context" is, well, required :-) )
So the question: Is there any way to mimic the other behavior, i.e. if there's no term context, the embedded views can still display, just unfiltered?
I'm trying to do the exact
I'm trying to do the exact same thing and having problems. I believe I have everything set up like alaken. Could someone review my configuration and see if I'm missing something obvious? Versions I'm using:
Drupal: 5.10
Views: 5.x-1.6
Panels: 5.x-2.0-rc1a and 5.x-2.x-dev
http://groups.drupal.org/files/view_pane_config.jpg
http://groups.drupal.org/files/panel_content_config.jpg
http://groups.drupal.org/files/panel_context_config.jpg
Follow up...
I just want to follow up on this in case someone else comes here on a search. I found I had to change the view type on the Views pane configuration to "Embedded" instead of "Page." As I didn't include that as part of my screenshots, it seems they weren't very helpful after all :) Hopefully this post saves someone else some time.
still struggling
Hi there,
what I'm having difficulty with is I just don't get the options I see above. Where do I find these?
http://groups.drupal.org/files/view_pane_config.jpg
In the view pane, I just get the choice to Taxonomy Term ID: drop down from which I choose Term from nod (and then the normal pane options such as style)
I don't get: Argument Source, Required Context, Panel argument, Fixed Argument or Label
I'm using the same versions of things as you are? Any ideas?
ok understand this bit now
One step at a time I suppose. I now realise you have to add the view as a panel pane.
Done that...configured it just as you guys have but get nothing coming through. Even though it's set to display all values I still get nothing through.
I think I'm trying to do something similar ...
I have a view that returns all nodes of type X, created by user Y (uid from argument).
I created a Views Pane for this view.
And then embedded that Views Pane in a Panels Page which has a url of events/%. This works great for users who have created nodes of type X. However I get a "Page not found" for users who have not created any nodes of type X.
I have tried:
- setting my argument default to all values (Display all values etc)
- adding additional custom content to the Panel Page so that some text is always shown/can be defaulted to
- giving the Panel Page a static title
- giving the Panel Page a title that uses the %user context
None of the above prevent the "Page not found" from displaying when the uid doesn't have any nodes of type X associated with it. Any one else encountered this? Is this intentional? Is there a workaround?
Views Argument Display Empty Text
Have you tried setting your views argument to display Empty text if the argument is not present? Then fill in the empty text field with whatever you'd like to display to users who haven't provided content for that view. Not sure if that's what your trying to do.
Similar problem but some elaboration would be helpful
I have a similar situation to the OP, except I'm attempting to display current room openings (view of open room nodes) for a collection of houses (individual pages for each house).
Path: house/nid
Like the OP, I've also tried similar steps:
However, I have not been able to reap the same success from merlinofchaos's helpful advice.
In the Panel Pane display for the view, I also have added Taxonomy: Term ID to the Arguments section to display all values if the term isn't present. Additionally, I've configured the Argument Input in Pane Settings to have "Taxonomy: Term ID source:" be "From context" and the "Required context" to be "Taxonomy term".
But it doesn't seem to work, and I'm not sure why. Perhaps the most confusing aspect is how I'm supposed to configure the filter - Taxonomy: Term so that it filters based on the term that's passed to it. When I add the filter it asks me which vocabulary I want to use, I choose "House" and the "dropdown" method of selection. Then when I'm allowed to select the terms, I've so far left it blank, believing it would then select all the nodes no matter which house node ID was in the main panel.
What am I doing wrong? Would screen shots help? Any advice would be wonderful. Thanks