Steps to reproduce:

- Enable Content translation and more than one language
- Allow Panels nodes to be translated in content type settings
- Enable the language switcher block
- Create a panels node in English
- Create a panels node in $language
- View either of the panels nodes
- When clicking a language in the language switcher, the interface and URL prefix will change correctly (note 'no prefix' is correct for English), but the nid remains unchanged.
- With 'normal' content types, the nid changes too, showing you the node in whichever language you've selected.

CommentFileSizeAuthor
#9 get.patch2.22 KBcatch
#7 get.patch2.23 KBcatch
#5 get.patch2.28 KBcatch

Comments

catch’s picture

Couple more things - language is set in {node} but tnid isn't. When editing a panels node, language information is reset to 'default' and the translation tab is lost.

OK, this is because panels implements it's own node form, so translation.module's hook_form_alter isn't interacting with it correctly:
http://api.drupal.org/api/function/translation_form_alter/6

cpelham’s picture

I'm having the same problem, with both nodes and blocks inserted into panel pages. Nodes inserted via a view DO change language correctly though.

TheRec’s picture

Marked #316733: "add translation" does not add a translation as duplicate. And subscribing.
I could not reproduce "Translate" tab disappearing.
Setting tnid to an unused value seems to work fine as a temporary fix, I have certainly not tested all the extend of this "trick".

catch’s picture

OK, I worked out what the problem is, it's actual fairly simple (although I've not looked at fixing it yet).

When you translate a node, the tnid and language are taken via $_GET - because panels node creation is a multistep form, these get lost.

So creating a panels node, and adding those to the url, for example: http://d6.6/node/add/panel/onecol?translation=1&language=fr works fine.

Seems like the layout selection form would need to persist the $_GET parameters and pass them along to the node form itself.

catch’s picture

Title: Panels nodes not affected by language switcher » Panels node forms lose $_GET query strings
Status: Active » Needs review
StatusFileSize
new2.28 KB

Patched. What I've done is take $_GET, remove 'q', and pass it along to the calls to drupal_goto and panels_print_layout_link - this way it'll work generically for any hook_ nodeapi($op = 'prepare') which is pulling information from $_GET.

TheRec’s picture

Title: Panels node forms lose $_GET query strings » Unable to create/add node translations for Panel nodes

I don't have time right now to test your code sorry. Reading it makes be think it's the right solution, but I am not sure it is recommanded to deal directly with $_GET. I guess the module maintainers will know better than me. Anyways, thanks for the patch, looking forward to test it.

I think your title does not describe exactly the problem but the solution you found. Hope this new title helps other people to find this issue more easily :)

catch’s picture

StatusFileSize
new2.23 KB

Spoke to tha_sun in irc, re-rolled with drupal_query_string_encode and an extra space.

sun’s picture

Status: Needs review » Needs work

$options should have a argument default value, i.e. = array():

+function panels_print_layout_link($id, $layout, $link, $options) {
+  $options['html'] = TRUE;

This will invoke a PHP notice on E^ALL, due to $options not being declared as array:

+  $options['query'] = drupal_query_string_encode($_GET, array('q'));

Whenever possible, avoid adding unnecessary blank lines or changes:

-      return drupal_goto('node/add/panel/choose-layout');
+
+      return drupal_goto('node/add/panel/choose-layout', drupal_query_string_encode($_GET, array('q')));

A good rule of thumb is to open and look at the patch file yourself after creating it. Most often, one is able to identify issues like the ones above in front of submitting it.

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.22 KB

That's tha_sun, should've spotted these before posting. This one should be a bit tidier.

TheRec’s picture

I tested this last patch and I played a moment with panels nodes translations and I didn't notice any problem. Thanks for this patch catch and sun :)

merlinofchaos’s picture

Status: Needs review » Closed (fixed)

Panels 2.x for Drupal 6 is now deprecated and has been removed. All issues against this version of Panels are being closed.

R.Hendel’s picture

Version: 6.x-2.x-dev » 6.x-3.2
Status: Closed (fixed) » Active

Hello,
I found same problem in PanelNodes 6.x-3.2
I have tried /node/add/panel/onecol?translation=1&language=de but this does not give me a translateble node. There is no access possible to /node/nid/translate
So I will reopen this issue.

Has anybody an idea?

Thanks in advance,
Ralf

R.Hendel’s picture

Status: Active » Closed (fixed)

Sorry - was a false alarm.
I did forget to give the node a language. So it could not be translated. Not a problem of panelnode. More a problem of user ;-)

webcultist’s picture

Version: 6.x-3.2 » 7.x-3.0-alpha3
Status: Closed (fixed) » Active

I still have the same problem in 7.x-3.0-alpha3.
It's not possible to create a content translation for a panels node.
When I click the translate link, I simply stay in the translation overview interface.

Letharion’s picture

Status: Active » Closed (fixed)

@webcultist, this issue has been closed for over two years. Clearly, whatever your problem is, it's a different one, so please open a separate issue. Also, please note that Panelizer will be the future of Panel nodes in the very near future, so you may wanna look into that, instead of using Panel Nodes. Panel Nodes are unlikely to recieve many more bug-fixes. Here's the issue with an upgrade path, if you're interested: #1353542: Upgrade path from Panel Nodes to Panelizer

webcultist’s picture

@Letharion, thank you for this information!
The panelizer and the upgrade path sounds like a good solution.

tommychris’s picture

Ok, this is a 2 year issue, but what is the solution to fix it?
Now, I don't want to use panelizer, I want to use Panel Nodes.

merlinofchaos’s picture

Panel nodes are more or less deprecated in favor of Panelizer, to be honest. About the only thing that will ever be changed in panel nodes is when we get the migration path written; then they will be formally deprecated.

tommychris’s picture

I see, thanks.