- Douglas Gottlieb, Vice President, Creative Group at Barnes&Noble.com
- Kevin Meyers, Meyers Design Inc.
- Robert Douglas, Senior Drupal Advisor, Acquia
We built this city on rock&roll! ♫ And by city I mean this site, and by rock&roll, I mean Panels3!
One of the things I've been meaning to really wrap my head around with Panels3, has been the Context. I had tried doing this from (what I thought was) the traditional perspective, in that you have a panel, you add a node context for it, and that becomes the context of the panel. However, every time I tried to do this, Panels kept asking me to specify a Node ID. I don't wanna specify a Node ID! I want it to be any random node that is given as an argument! How the hell...?
So let me show you what I found.
First of all, you have to set the argument. When creating a new panel, you first specify a path. This path needs to be aware that you are going to be sending an argument. Something like the system node view panel does, with 'node/%node'. ![]()
This gives your panel the concept of an argument, and therefor a tab to tell the panel what sort of argument this is! The node_view panel already has the argument defined as a node object, so let's setup another panel that uses an argument. Let's setup one for /group/%node/discussions, in which we'll display a list of discussion with a group node's context.

You will now notice that the Arguments tab will have this %node listed and you can tell the panel exactly what kind of argument %node is.

You have a bunch of options here, and since we're working with a group, I've installed the og_panels module which gives us an Organic Group option. However, this wasn't working for me, so let's just use Node ID and I'll show you what piece actually did.

Now we want to focus on the Context tab for our panel variant.

You'll notice that I already have the Organic Group from node context set From the "Node ID". This is accomplished choosing the Organic Group from node option under Relationships.

So what this basically does is say to panels, that when an argument is passed into this panel, it is a node, and not only is it just a node, but it is a Group node and therefor has a relationship to any of the group information.
So what does all of this accomplish? Well, now that our panel knows that the Node ID was pass into this path has a relationship to Groups, we now have a new tab when we go to add content to our Panel layout. So let's go to our main Content tab and add a new pane to one of our regions.

Not only do we have a Node tab which gives us objects related to the node, but we also now have an Organic Groups tab which lists a lot of the relevant Group objects related to this node.

I hope this has helped you get a little better understanding of how arguments and context relationships with Panels3 work. If you have questions, please feel free to comment and always, always, keep rockin'! \m/
// comments
Thanks for the Panels 3
Thanks for the Panels 3 context explanation. I'm stuck trying to integrate OG with panels3. Do you know any indepth articles out there that can help someone new to OG view it with a standard panels display. It seems every keyword points to the indev og_panels module. Not really interested in user customizable panels. I just would like a standard panels configuration for all group posts. Gadzooks! Go Eagles!
My instructions here
My instructions here basically address that except you will not have group context available without panels_og.
Exactly what I've been
Exactly what I've been looking for. This kind of info on using the more complex contrib modules is absolute gold dust - thanks. It saved me loads of time I would have spent digging through the code/database to find out how it works.
Thanks again
// add comment