I am working on a multilingual site having English and French laguages with English as default language. I have a block which is generating a custom form.
When setting this block to load with Ajax, the form action is populated with the unaliased path (/node/*) in the form action. Also the form action in the French langauge is coming with unalaiased path with out langauge code(/node/* instead of fr/node/*) in the URL. So in the french page when submitting the form, French page is navigating to the English page.
Upon checking the code, I found code in the below function is causing this issue.
function _ajaxblocks_fix_request_uri($path) {
if (isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = '/' . $path;
}
// TODO support other ways to fix request_uri().
}
so I changed the above function to
function _ajaxblocks_fix_request_uri($path) {
if (isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = url($path);
}
// TODO support other ways to fix request_uri().
}
Comment | File | Size | Author |
---|---|---|---|
#1 | ajax_blocks_unaliased_path-2370595.patch | 429 bytes | krishna savithraj |
Comments
Comment #1
krishna savithraj CreditAttribution: krishna savithraj commentedComment #2
krishna savithraj CreditAttribution: krishna savithraj commentedComment #3
maximpodorov CreditAttribution: maximpodorov commentedOh, yes, it's a reasonable fix.
Comment #4
cthshabel CreditAttribution: cthshabel commentedI have tested this and it works fine with the change.
It was causing problems with google_analytics_reports when loading via ajax blocks when using an alias path.
Can we commit this soon?
Thanks for the patch!
Comment #5
krishna savithraj CreditAttribution: krishna savithraj commented