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().
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

krishna savithraj’s picture

krishna savithraj’s picture

Issue summary: View changes
maximpodorov’s picture

Oh, yes, it's a reasonable fix.

cthshabel’s picture

I 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!

krishna savithraj’s picture

Status: Active » Reviewed & tested by the community