Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I had problems with printing my views with URL parameters (exposed filters).
D7 needs different passing of URL parameters. Please update this function.
function print_query_string_encode($query, $exclude = array(), $parent = '') {
$params = array();
foreach ($query as $key => $value) {
if ($parent) {
$key = $parent . '[' . $key . ']';
}
if (in_array($key, $exclude)) {
continue;
}
if (is_array($value)) {
$params[] = print_query_string_encode($value, $exclude, $key);
}
else {
$params[$key] = rawurlencode($value);
}
}
return $params;
}
Just modify 1 line to
$params[$key] = rawurlencode($value);
Comment | File | Size | Author |
---|---|---|---|
#9 | print-fix-url-1322222-9.patch | 667 bytes | oadaeh |
#2 | print_1322222_url_encoding.patch | 410 bytes | Simon Georges |
Comments
Comment #1
jcnventura CreditAttribution: jcnventura commentedComment #2
Simon Georges CreditAttribution: Simon Georges commentedThe according patch is attached (all credits go to jacerny).
Comment #3
nathanjo CreditAttribution: nathanjo commentedThis patch should be made in the next dev release.
Same case and using this patch solve the query issue in views.
Comment #4
jcnventura CreditAttribution: jcnventura commentedThanks everyone.. I've committed this to git.
Comment #5
Pentacor CreditAttribution: Pentacor commentedHave updated to latest dev module, the problem is still happening though. When having applied exposed filters to a view if I click 'email this page', the page emailed is not correctly filtered.
The filters I'm using are date form and to inputs to capture nodes between 2 dates. The first date is being captured in the querystring but the second date is not (see below for the url captured and what the url captured should be):
?field_date_value%5Bmin%5D%5Bdate%5D=2012-03-15&1[field_date_value%5Bmax%5D%5Bdate%5D]=2012-03-23
?field_date_value%5Bmin%5D%5Bdate%5D=2012-03-15&field_date_value%5Bmax%5D%5Bdate%5D=2012-03-23
As you can see only part of the querystring is being captured by the function, any ideas?
Thanks for help
Comment #6
Pentacor CreditAttribution: Pentacor commentedComment #7
jcnventura CreditAttribution: jcnventura commentedDo not cross-post.. I've little enough time to fix bugs as it is...
Comment #8
jcnventura CreditAttribution: jcnventura commentedComment #9
oadaeh CreditAttribution: oadaeh commentedI'm not sure if this it the correct issue to post it, but it seems the closest to me.
I, too, had the problem as @Pentacor in #5, but the recommended fixes in this issue did not correct it. The attached patch fixes the problem for me. Hopefully, it doesn't cause other problems.
BTW, none of the recommended solutions were ever committed, as indicated in #4.
Comment #10
jcnventura CreditAttribution: jcnventura commented#4 was indeed committed, I can see the commit result in your patch.. But it was indeed incomplete.
I've committed your patch to dev.
Comment #12
JCL324Apologies if there is already an issue for the 2.x-dev branch, but I am using 7.x-2.0-beta1+11-dev (2012-Jun-24) and it appears that these patches here have not been added. I will revert to the 1.x-dev version.
Update: I have reverted to (7.x-1.1+7-dev (2012-Jun-28)) and still have an issue with incorrect URLs. I completely deleted the 2.x-dev version, installed 1.x-dev, flushed caches and did a DB update (wasn't required). I verified that the above patch #9 was indeed in the print.module code.
My view page has 2 exposed filters:
View URL = /oos-records?field_municipality_tid%5B%5D=44&field_type_tid%5B%5D=1&field_type_tid%5B%5D=2
Print URL = /oos-records?field_municipality_tid&field_type_tid[1]=2
It seems to drop the value for the first filter and ignores the middle one. Can't the code just take the existing URL and inserting "print/" in front of it? When I do that manually, it works just fine.
Comment #13
jcnventura CreditAttribution: jcnventura commentedIt works for you, but unfortunately not for PHP code..
Comment #14
jcnventura CreditAttribution: jcnventura commentedThanks to mbouchard58 when reporting #1703088: Exposed Filters Views Integration, I think I finally figured this out.
http://drupalcode.org/project/print.git/commit/2ab48a3
Comment #15
JCL324Basically what I reported in #12 :-)