I have a support request here, but am not sure if it includes a bug with override path settings…

I'm not sure if I'm misunderstanding the usage here, but when I attempt to use the Override Path setting in my View Pane I seem to get mixed results. The Override Path setting reads "If this is set, override the View URL path; this can sometimes be useful to set to the panel URL. You may use substitutions in this path."

When I use a substitution %term:name, it prints as %252F in the rendered URL and appends the argument to the end. However if I just use % in the override path, the argument is added properly.

Details on what I have set up…

I'm using the Taxonomy term template with a variant to target a specific vocabulary. My panel contains 3 view panes, all of which use the %term:tid argument to filter content. Using Pathauto I've established aliases for 'taxonomy/term/[tid]' to resolve to 'index/[term]' and this works well and displays my layout created with Panels. Now I'd like to create 3 sub-pages for each term at 'index/[term]/foo', 'index/[term]/bar', etc…

As I understand Views, the Views more link function only links to a Views page display, but I want to use a custom page to layout this full page display of each view pane. So I've disabled the Views more link and am using the Panels provided more link setting. Then, using the Override Path setting I try to use 'index/%term:name/foo' and get the above issue.

When I set the override to 'index/%/foo' the display is right and the only issue leftover is converting the Term ID to a Term name in the URL. This is what I was hoping the override path would provide from the initial pane.

Comments

jason.bell’s picture

Title: Views pane and poverride path setting » Views pane and override path setting
clem.chuang@gmail.com’s picture

I think I met the same problem.
I set "node/disease/list#group_gid_%term:tid" in Override path,if %term:tid is 128,the output more link's url is http://www.somewebsite.com/node/disease/list#group_gid_/128.
Any solution?Where is the "/" comes from?

mrfelton’s picture

I think panels is encoding the fragment identifier. I have the same problem with querystrings. I need to be able to link from a panel pane (via the more link override on a views content pane) to another panel page, but I need to append ?gids_node[]=4 to the path, so the final path would be chapter/%chapter/blog?gids_node[]=4. By passing the querystring to the panels page display like that, I can then have og_context know that the custom panels page for the blog listing is part of a specific organic group context. Unfortunately, this seems impossible with Panels at the moment.

I have tried using views_pre_render to adjust the path override just prior to display, but it still gets encoded at that point, so it's probably not really a problem with panels.

function nfla_chapter_ui_views_pre_render(&$view) {
  if($view->name == 'sac_chapter_blog' && $view->current_display == 'panel_pane_1') {
      dsm($view);
      $view->override_path = 'blog?gid=dd';
  }
}
mrfelton’s picture

I got my thing working in the end by doing this:


function nfla_chapter_ui_preprocess_views_view(&$view) {
  //krumo($view);
  if($view['name'] == 'sac_chapter_blog' && $view['display_id'] == 'panel_pane_1') {
    $group = og_context();
    // Only adjust the more link if we are in a group context to begin with.
    if ($group && isset($view['more']) && !empty($view['more'])) {
      $url_options = array(
        'query' => array('gids_node[]' => $group->etid),
      );
      $theme = views_theme_functions('views_more', $view['view']->view, $view['view']->display);
      $path = check_url(url('chapter/' . $group->gid . '/blog', $url_options));
      $view['more'] = theme($theme, array('more_url' => $path, 'link_text' => 'more');
    } 
  }
}

Really does seem like a lot of hoops to jump through just to get a querystring into the path override. What's the reason for not allowing these in panels itself?

merlinofchaos’s picture

Why are you saying Panels when the code is Views' code?

Views doesn't actually support query strings in its paths, so it was never written to take apart a path and reassemble it properly; and Drupal's URL functions require it to be done that way. So it's a hassle to do and hasn't been done there. But that's $view->override_path and nothing to do with Panels...

Letharion’s picture

Status: Active » Fixed

Closing as fixed because merlin has answered. If anyone needs more help with this, move it to the Views project and update the appropriate issue settings.

mrfelton’s picture

Title: Views pane and override path setting » Support query strings and fragment identifiers in views paths
Project: Panels » Views (for Drupal 7)
Version: 6.x-3.7 » 7.x-3.x-dev
Component: Views panes » Code
Category: support » feature
Status: Fixed » Active

@merlinofchaos - I was saying Panels because the problem manifests itself in the Panels UI, so at first glance it would seem to be a problem with Panels. Which is why I would imagine that the original poster created this issue in the Panels issue queue, and why I found it by searching in the Panels issue queue. It was only through tracing and debugging that I figures it was actually a problem of Views, and that altering the view output just before it gets displayed would let me do what I needed to do.

As suggested by @Letharion, I'm moving this over to the Views issue queue, as it seems that this problem is due to a shortcoming with Views, which is currently unable to support query strings in its paths. This is now a feature request.