In entity_translation_overview() if there is a destination url parameter, any custom url parameters for the add/edit links are overwritten.

For example, I have a custom module that adds a query parameter when switching languages, which works fine unless there is a destination parameter on the translation overview page.

Expected Result

When on: /node/789/translate
The edit url is: /zh/node/789/edit/zh-hans?langswitch=zh-hans

When on: /node/789/translate?destination=admin/content
The edit url is: /zh/node/789/edit/zh-hans?langswitch=zh-hans&destination=admin/content

Actual Result

When on: /node/789/translate
The edit url is: /zh/node/789/edit/zh-hans?langswitch=zh-hans

When on: /node/789/translate?destination=admin/content
The edit url is: /zh/node/789/edit/zh-hans?destination=admin/content

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jojonaloha’s picture

Status: Active » Needs review
FileSize
1.97 KB

Attached patch sets $link['query'] to an empty array if it isn't set already before using += to extend the array and add the destination parameter.

stefanos.petrakis@gmail.com’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hello there,

I just tested this, here are some points:

+ Applies cleanly, on a D7.50 against ET 7.x-1.x-dev
+ Patch looks fine and makes sense.
+ I would need some more info to reproduce the described problem and confirm that the patch solves it. Best would be some code snippet, as close as possible to the one that gave you the problem in the first place. Tried using a hook_url_outbound_alter implementation, but that didn't produce the problem described.

Setting this to postponed for the time, following from the 3. point above.

plach’s picture

Even better would be a failing test, although all tests are failing now (I'll try to fix that ASAP :)