I have an http_response variant that redirects the taxonomy term view page to a view, such that

taxonomy/term/1 => videos/tags/kittens

I need to be able to pass query parameters through to my views display, such that

taxonomy/term/1?keywords=whiskers => videos/tags/kittens?keywords=whiskers

Right now the query string handling in page_manager_http_response_render() respects any query parameters that are specified in $handler['conf'], but it drops query parameters from the current request. To me it would make sense to pass along any query parameters from the current request as part of the redirect.

Comments

ksenzee created an issue. See original summary.

ksenzee’s picture

Status: Active » Needs review
StatusFileSize
new997 bytes
merlinofchaos’s picture

IMO, on a redirect, the preservation of query string should be optional and not enabled by default. However, the use case for preserving the query string makes sense.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 3 year old patch to http_response.inc does not apply to the latest ctools 7.x-1.x-dev.

Checking patch page_manager/plugins/task_handlers/http_response.inc...
error: while searching for:
  if ($info['response code'] == 301) {
    $path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts);
    $url = parse_url($path);
    if (isset($url['query'])) {
      $path = strtr($path, array('?' . $url['query'] => ''));
      $info['query'] = drupal_get_query_array($url['query']);
    }
    if (isset($url['fragment'])) {
      $path = strtr($path, array('#' . $url['fragment'] => ''));

error: patch failed: page_manager/plugins/task_handlers/http_response.inc:316
error: page_manager/plugins/task_handlers/http_response.inc: patch does not apply
Snehal Brahmbhatt’s picture

Status: Needs work » Needs review
StatusFileSize
new1.01 KB

@Chris2, Find the attached that rerolled for ctools 7.x-1.x-dev as per the added requirement in #4.

Thanks!..

rivimey’s picture

Review-wise, the thought seems good but:

  • I'm with #3 - given this is a change to existing behaviour, it should be disabled by default and enable-able somehow.
  • Use of the array += operator always causes concern. Are you 100% sure it should not be array_merge() in this case

Finally, some tests should be added to check that both the query is, and is not, passed through.

rivimey’s picture

pieterdc’s picture

Status: Needs review » Needs work

Agree with @rivimey
Enable-able can be done by extending the configuration form in page_manager_http_response_edit_settings().

japerry’s picture

Status: Needs work » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.