I am trying to use Panels to make a block view take a Node Reference nid as an argument. Here's what I did:
1. Created views pane for view. View type=Block, Argument source=From context, Required context=Node.
2. Created mini-panel. Added views pane as content.
3. Set mini-panel block to show up as content on page node/83.

Now when I browse to node/83/nid_argument_here, I see a blank white screen. (I also see a blank white screen at node/83). I would like to see my block view on the page, restricted by nid argument. What am I doing wrong?

Comments

nadu’s picture

I have problem like yours. I think that mini panel just take context from panel-pages but not node view so views can't take arguments from mini panel.

My solutions is passing arguments directyly to views. In the view's Argument Handling Code, you paste the following code:

if ($view->build_type == 'block' && arg(0) == 'node' && is_numeric(arg(1))) {
$args[0] = arg(1);
}
return $args;

so the view can get argument directyly from URL.

You can see more here: http://drupal.org/node/83415.

Any other ideas?

threexk’s picture

I actually ended up implementing argument-handling code just as you suggest, nadu. The whole reason I came to Panels though is to try to avoid this sort of code.

It would be better if a views block did not have to care about its context. i.e., I shouldn't have to anticipate all the places a views block will be placed on my site and code arg()-based conditionals for them. It should just know that the last part of the URL are its arguments.

Thank you for the response nonetheless. I'm still curious whether there is a way to do this with panels, and will be looking more into it...

sdboyer’s picture

Component: Mini panels » Plugins - relationships

Ahhh, node reference...I actually just wrote some argument handling code for a similar thing on a project where we weren't using panels. phooey.

Basically, we need to write a new relationship plugin to handle nodereference specifically. It'll be a little wonky, because that could be a really tricky widget to implement in an abstract way that works. Well, maybe. Anyway, the earliest I can really be sure I'd get to this is sometime next month, so it'd be great if someone else could write the plugin.

kulfi’s picture

subscribing

sun’s picture

Title: Passing argument to block view on a page? » Allow passing argument to block view on a page
Version: 5.x-2.0-beta5 » 6.x-2.x-dev
Category: support » feature
frankcarey’s picture

+1 for this, any progress or ideas on how to implement?

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Panels 2 is no longer available and is unsupported. Marking all Panels 2 issues won't fix.