Hello,
Can someone give me some, step by step instructions on how to pass an argument from a panel (Panels 3.7) to a view (Views 2.11) in Drupal 6.x? I've been at this for hours (currently 2 days), and have tried multiple methods I've found in searches, but nothing works.
What I've done is created a View that take an argument. It is of "Default" or "Page" type, not "Content pane". The argument is a "Node translation: Language". When the View receives a valid argument, it displays a list of nodes only of given language. So far so good. My view works fine when I view it on it's own, using page. For example www.mysite.com/productlist/en (displays nodes in English) or www.mysite.com/productlist/po (displays nodes in Portuguese).
What I want to do is create two separate panels. Put that View in each Panel with predefined language. So one panel automatically pass to view EN as parameter and English nodes will be displayed, second panel will pass PO to view and Portuguese nodes will be displayed.
No parameters from URL should be taken, just predefined inside panel.
I've tried whatever possible solutions, and receive either empty view or nodes in all languages are displayed, it depends on view setting "Action to take if argument is not present". So I could conclude parameter is not passed from panel to view.
Please help me what I need to do get the Panel to pass the argument on to the View?
As workaround I found possibility to use filter "Language = Current user's language" so one view works fine for both languages. For this particular task it is OK.
But passing some arguments from panels is still the issue to clarify, cause if some dynamic values will be required, predefined views won't help.
Comments
Comment #1
merlinofchaos commentedThere are many methods to getting arguments from a panel to a view.
The one I recommend the most is to use a context. Using the 'content pane' display type, there's an 'Arguments' link in the pane settings. You can set your argument to populate 'from context'. Be sure to set the name and category so you can find the view in the add content dialog; content panes do not show up in the 'Views' section. You have to select a context type. String is probably the most appropriate.
Then, you have to ensure your panel has an appropriate context. If you're not getting this as an argument from the URL, go to the contexts tab and add a string context with the appropriate language.
Update this, then go to the content tab. Add the view. It should have a select widget for the view argument which will contain the possible string contexts. Save that and you should be good to go.
Comment #2
mini_me commentedThanks will try to implement as described ;)