Can you get any view to list content based on a field value? I am trying to get a list view in a panels node template to show content based on a text field of the currently viewed node.

Just to give you more information I am including my setup below:

Content Type A - textfield called 'ref'.
Content Type B - textfield called 'a_ref'.

Content Pane View to show list of Content Type B but filtered depending on the node being viewed.

Node template on Content Type A with two regions (Left and Right).

On the Left I am displaying fields of the node being viewed.
On the Right I want to show the Content Pane View with a list of Content Type B where 'a_ref' is equal to 'ref'.

I am trying to figure out how to use contextual filters between the node template and content pane but to no avail.

I hope anyone out there can enlighten me on the way it should be done.

Thanks in advance for any help,

Kevin
Solution


Get the view, and the view alone to do what you want. You need a contextual filter on the field you want to match against. Test the view out in the views UI.
Add a content pane display, this requires the views content module to be enabled. In the pane settings, find argument inputs settings (Sorry, no UI in front of me, that setting could be something else). In here you can tell Views what type of data the View should expect for the contextual filter. Pick From context. You'll be presented with a looong list of available options, it's easy to get this wrong, be careful. Scroll down until you under Node find the field you are trying to match against. If you have multiple fields with the same label, there is no easy way to know which is which. Yes, it's crap, you will have to go trial-and-error until this gets fixed. Save the view.
Go into Panels. Ensure that the new view is visible under the View panes category, not just Views. Add the view, tell it which node to get data from, which is usually just one, save.


Troubleshooting

This setup is non-trivial for a lot of users. I find that the common most problem people hit is configuring the view to require a certain type of input. If you can't get this to work, there are two things to try.


The Panels process for identifying which Views are valid, seemingly can get stuck sometimes. Clear caches, and resave both the View and Page.
In the Views arguments configuration, set the argument to be optional. This is not really what you want, but if this causes the View to show up in the Panels UI, then we know the problem is that Panels does not have access to the information that the View says it wants, which at least narrows the problem down a lot.