I've been upgrading a site to Drupal 5, and noticed a change in the insert_view behavior with exposed filters:

let's say I have a view named "customers", that displays a list of customers with an exposed filter (taxonomy term "industry"). That way the user can sort customers by industry.

Then I embed this view in a page "node/150", using insert_view

in Drupal 4.7, when I use the exposed filter, it redirects to something like this:
"node%2F150&filter0%5B%5D=20"

However, in Drupal 5.1, it redirects to this:
"views%2Fcustomers&filter0%5B%5D=20"

So, you see, it redirects to the view page, not to the node where I have embedded the view. It is a bit of a problem.

Comments

Hubert_r’s picture

Priority: Normal » Critical

Any idea on this one?

mlsamuelson’s picture

h_razack,

What versions of Views are you using?

I'll see if I can't look into this more over the next few days.

mlsamuelson

merlinofchaos’s picture

Assuming you're embedding your view via views_build_view, prior to actually calling that function try $view->url = 'node/150' (or whatever the node you're currently looking at is).

If you're using insert_view, that probably won't work.

What you've probably run into is a good result from an unintended behavior that was later fixed.

mlsamuelson’s picture

Assigned: Unassigned » mlsamuelson

As insert_view is using views_build_view to embed the view, adding

$view->url = arg(0) . '/' . arg(1);

before views_build_view does the trick.

I want to test this a bit more and give others a chance to add their thoughts on the subject, but if it doesn't seem to cause any problems, I'll probably add the functionality to the 5.x branch.

mlsamuelson

mlsamuelson’s picture

Status: Active » Fixed

I've committed to the 5 branch and to HEAD a fix for this issue. Nodes containing inserted views with exposed filters now submit back to the original node with the inserted view feeling the update.

Instead of using arg, I ended up using:

$view->url = $_GET['q'];

Thanks for putting me on the trail for this fix, merlinofchaos.

mlsamuelson

Anonymous’s picture

Status: Fixed » Closed (fixed)