#1 views-language_prefix_for_ajax-1803758-1.patch536 bytesbsuttis
Test request sent.
Previous result: PASSED: [[SimpleTest]]: [MySQL] 1,658 pass(es).
[ View ]


bsuttis’s picture

Status:Active» Needs review
new536 bytes
Test request sent.
Previous result: PASSED: [[SimpleTest]]: [MySQL] 1,658 pass(es).
[ View ]

Narrowed it down to js/base.js

Attached is a patch, it checks for the existence of Drupal.settings.pathPrefix and prepends it to viewPath.

This makes if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') pass, as without the language prefix path.substring(0, viewPath.length + 1) was removing the last 3 characters of the path

Without this patch, this happens:
path.substring(0, viewPath.length + 1) == en/admin/organizatio
viewPath + '/' == admin/organizations/

With this patch:
path.substring(0, viewPath.length + 1) == en/admin/organizations/
viewPath + '/' == en/admin/organizations/

JulienThomas’s picture

Good afternoon.

Thank your for this patch. It solved my bug too!

issa.haddadin’s picture

Thank you..

It worked with me too!

issa.haddadin’s picture

Version:7.x-3.5» 7.x-3.7
Status:Needs review» Reviewed & tested by the community

I tried this with latest views "7.x-3.7" version and it's working good.

weri’s picture

Priority:Normal» Major

I applied this patch to 7.x-3.7 and the ajax call works also with language prefixes.

candelas’s picture

Version:7.x-3.7» 7.x-3.x-dev

thanks @bsuttis :) it works perfect.

i tested it in the dev version to help this patch to be commited.

i had the same problem: the glossary view didnt work with ajax in a multilingual site, but it worked without ajax.
i applied the patch in the dev version and now ajax works.
i hope that it can be commited to the dev version.
thanks to all people that contributes to views :)

e5sego’s picture

Issue summary:View changes
Issue tags:+i18n
e5sego’s picture

Applyed the patch to 7.x-3.7 which solved the problem using glossary + ajax + internationalization / i18n.

Also added i18n tag to this issue, it's might be hard to find the patch. Hope that's right.

alienzed’s picture

JUST what I was looking for. I must admit it took me some time to find this thread. I wonder why this patch is not in Views 3.8...
I can confirm that patching 3.8 works as well. This is a bug though and should be fixed permanently right?

dawehner’s picture

weri’s picture

The patch works with 3.8 and DEV. I hope it gets added to the next release.

stefan.r’s picture

This works, can we get this committed?

bendev’s picture

I confirm this is working for me too with Views 3.8
thank you

bendev’s picture

too bad it was not commited yet...

Still working with views 7.X-3.10

stefan.r’s picture

Confirming RTBC

Scott Robertson’s picture

Also confirming that this patch works for me.

D4K0’s picture

Version:7.x-3.x-dev» 7.x-3.11
Issue summary:View changes

I've applied this patch to 7.X-3.11 and it fixed my broken ajax calls with language prefixes. THX.
Confirming RTBC.

joelpittet’s picture

Version:7.x-3.11» 7.x-3.x-dev

Any work will be done against the dev branch, that's why it's set to that.

leymannx’s picture

Excuse me, I'm wondering why it takes 3 years for the patch to finally get merged?

stefan.r’s picture

Does Drupal 8 have this issue as well? core/modules/views/js/base.js has the same code...

D4K0’s picture

Yes, it does.
Did some debugging on D8 RC2 version.
Noticed Drupal.settings.pathPrefix had changed to drupalSettings.path.pathPrefix in D8.

So that the condition should look like this

  if (drupalSettings.path.pathPrefix) {
    var viewPath = drupalSettings.path.pathPrefix + viewPath;
D4K0’s picture

FYI: I've already set up D8 issue