When using a custom 'edit path' setting in hook_entity_info(), such as that proposed by #2139009: Missing Entity Translation edit path breaks CTools JS patch https://www.drupal.org/files/issues/scald-2139009-2.patch, paths like the following (for adding a new translation)
fr/atom/%atom/edit/add/en/fr
are changed into
fr/atom/%atom/edit/%25ctools_js/add/en/fr
It seems that this breaks the local actions (the language switcher tabs, in this case 'English' and 'Français' - they are missing from the edit form when trying to add a new French translation). This in turn leads to the following warnings:
Warning: Invalid argument supplied for foreach() in EntityTranslationDefaultHandler->localTasksAlter() (line 1379 of /home/martin/public_html/migrate2/sites/all/modules/contrib/entity_translation/includes/translation.handler.inc).
Warning: array_merge(): Argument #1 is not an array in EntityTranslationDefaultHandler->localTasksAlter() (line 1422 of /home/martin/public_html/migrate2/sites/all/modules/contrib/entity_translation/includes/translation.handler.inc).
I've spent ages trying to understand the code in entity translation which handles all this, but I'm now just totally confused.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | invalidarg-2325585-5.patch | 707 bytes | sano |
Comments
Comment #1
nagy.balint commentedI also have this issue.
The configuration of the entity is:
This works when I open the edit page of a scald_atom entity in a ctools modal, however if i view the entity with its own display (overlay disabled) that has the translate tab, then the links on the translate tab are wrong as above.
like fr/atom/1059/edit/%25ctools_js/fr?multilink=switch and so it produces bad request.
If I change the edit path to atom/%scald_atom/edit then it works fine on the translate tab, however if i try to open the edit page in a ctools modal i get page not found, cause it tries to do atom/1059/edit/nojs, and that is incorrect.
Tried with path schemes but could not figure yet out how to set it up for this, also it seems that the code responsible of finding the correct scheme in the handler does not even run when i open the edit form into a ctools modal.
Is there a way to set this up so both situations work?
Comment #2
nagy.balint commentedI found one solution for my problem so far:
If edit path is 'atom/%scald_atom/edit/%ctools_js' and then in the custom handler i define the
Then it works fine in both areas. Because for our ctools links this function is not called, and when it is called it removes the ctools_js to fix all urls.
Not sure if there is a better way to fix this or not.
Comment #3
gaëlgI had the same error (maybe for another reason). I added this into scald.translation_handler.inc:
and it looks like it fixed the bug.
Comment #4
merilainen commentedI rolled the fix from #3 into patch for Scald https://www.drupal.org/node/2662494#comment-10821548
Comment #5
sano commentedI see similar error when I have the TabTamer module enabled and use it to disable some tabs.
Not sure if patching the translation.handler.inc in this module is the way to go, but it seems harmless. The patch is attached.
Comment #6
sano commented