I have several panels and mini panels to which I have added various node content. The panel previews show the correct nodes, but when I view the panels' URLs, the wrong nodes are displayed. This is the case even if I delete the node content and re-add, and it makes no difference whether I add "node content" or I add a node via context. I am not sure what to do. Is this a caching problem? But then why would the wrong node be cached?

CommentFileSizeAuthor
#6 panels_translationfix.patch849 bytescpelham

Comments

cpelham’s picture

Actually, the panel previews show the wrong nodes as well. When I first add the node content, the auto-complete finds and shows the correct NID and node title.

cpelham’s picture

Could this be related to the i18 module at all? The nodes in question that don't show up correctly are Japanese language nodes.

cpelham’s picture

Here is a little bit more specific information. When I export one of the panel pages with an included node context, the script (see below) shows the correct NID (5529) for the node that I want to display. However, when I actually load the page, the panel instead displays NID 1387.

I will try to save this script and see if I can get the appropriate variables to print out (my first time debugging php so I don't know if I can do it or not) to try to figure out where it goes wrong... Can anyone help?

$page = new stdClass();
$page->pid = 'new';
$page->name = 'test';
$page->title = 'test';
$page->arguments = array();
$page->relationships = array();
$page->access = array();
$page->path = 'panels-test';
$page->css_id = '';
$page->css = '';
$page->no_blocks = '0';
$page->switcher_options = array();
$page->menu = '0';
$page->menu_tab = '0';
$page->menu_tab_weight = '0';
$page->menu_title = '';
$page->menu_tab_default = '0';
$page->menu_tab_default_parent_type = 'tab';
$page->menu_parent_title = '';
$page->menu_parent_tab_weight = '0';
$page->contexts = array();
$page->contexts['0'] = array(
'name' => 'node';
'id' => 1;
'identifier' => 'NJ ACIM class';
'keyword' => 'node';
'context_settings' => array (
'node' => '5529',
'nid' => '5529',
);
);
$display = new panels_display();
$display->did = 'new';
$display->layout = 'onecol';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-1';
$pane->panel = 'middle';
$pane->type = 'node_content';
$pane->subtype = 'content';
$pane->access = array();
$pane->configuration = array (
'context' => 'context_node_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'link' => 1,
'teaser' => 0,
'page' => 1,
'links' => 1,
'no_extras' => 1,
'identifier' => '',
);
$pane->shown = '1';
$display->content['new-1'] = $pane;
$display->panels['middle'][0] = 'new-1';
$page->display = $display;
$page->displays = array();

cpelham’s picture

I made module using Panels Exporter. The module showed up and I was able to activate it. I changed the path so that I would be able to distinguish the module-generated panel page from the panels-generated panel page from which it was exported. However, the new path cannot be found. Is there something else I need to do to get this module to actually make the page?

Here is the script for my new module panelnodetest.module

<?php
// $Id: panelnodetest.module,v 1.1.2.18 2008/03/12 21:47:59 salvis Exp $

/**
* @file panelnodetest.module
*
*/

/**
* Implementation of hook_default_panel_pages()
*/
function panelnodetest_default_panel_pages() {
$page = new stdClass();
$page->pid = 'new';
$page->name = 'test';
$page->title = 'test';
$page->arguments = array();
$page->relationships = array();
$page->access = array();
$page->path = 'panels-testmodule';
$page->css_id = '';
$page->css = '';
$page->no_blocks = '0';
$page->switcher_options = array();
$page->menu = '0';
$page->menu_tab = '0';
$page->menu_tab_weight = '0';
$page->menu_title = '';
$page->menu_tab_default = '0';
$page->menu_tab_default_parent_type = 'tab';
$page->menu_parent_title = '';
$page->menu_parent_tab_weight = '0';
$page->contexts = array();
$page->contexts['0'] = array (
'name' => 'node',
'id' => 1,
'identifier' => 'NJ ACIM class',
'keyword' => 'node',
'context_settings' => array (
'node' => '5529',
'nid' => '5529',)
);
$display = new panels_display();
$display->did = 'new';
$display->layout = 'onecol';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-1';
$pane->panel = 'middle';
$pane->type = 'node_content';
$pane->subtype = 'content';
$pane->access = array();
$pane->configuration = array (
'context' => 'context_node_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'link' => 1,
'teaser' => 0,
'page' => 1,
'links' => 1,
'no_extras' => 1,
'identifier' => '',
);
$pane->shown = '1';
$display->content['new-1'] = $pane;
$display->panels['middle'][0] = 'new-1';
$page->display = $display;
$page->displays = array();
$pages['test'] = $page;

return $pages;
}

cpelham’s picture

Priority: Normal » Critical

OK...now I get my new module to generate the page but it still displays the wrong node. I just don't understand this since the NID is hard-coded into the module. So the Panels module is not using the NID stored in

$page->contexts['0'] = array (
'name' => 'node',
'id' => 1,
'identifier' => 'NJ ACIM class',
'keyword' => 'node',
'context_settings' => array (
'node' => '5529',
'nid' => '5529',)
);

to generate the displayed node. or some operation is being performed on the value to alter it. Where do I go looking for this? Is this a bug?

cpelham’s picture

Title: Panels show wrong node content after upgrading to rc1a » Panels show wrong node content if translation module is present but no translation for the node in question exists
Status: Active » Needs review
StatusFileSize
new849 bytes

The file contexts/node.inc in version 5.x-2.0-rc1a has some logic in lines 45-57 that checks to see if the translation module is active and, if so, looks up the NID for the translation of the node in question. However, if there is no translation then the node's NID gets replaced with another NID that is, as far as I can tell, random, or at least wrong. Simply adding another IF statement to check to see if $translation is not empty before doing the translated NID lookup and storing seems to fix this problem. If one's site has more than two languages (mine has only two), I am not sure if this is enough to get it working.

This is my very first time making a patch so please check well and forgive if I've made some fundamental mistake!

cpelham’s picture

Status: Needs review » Needs work

Ah, now I have found that my patch does not work if there is more than one node context. $nid and $translation are arrays and so it is presumably necessary to cycle through the arrays and make sure that if there are any NULL values for translations, that no arbitrary nid is inserted for them. I have to learn a little more about what kind of arrays these are and how they work, and then I'll try to submit a new patch...

gsquirrel’s picture

I am having the same issue - did you get any further with it? The site I am working on has 5 languages and my main reason for inserting a node using panels was to avoid the difficulty of translating views headers. If I enter dummy translations then it works as you say - maybe this has to be the workaround for now.

cpelham’s picture

I haven't figured it out yet. I have been trying to write various loops to cycle through the NID values, but I don't clearly understand how the data structure containing the NIDs is set up. I'm a bit new to this. I'll try to look at it more but I'm hoping somewhere more familiar with the code will take a look at it. I do think it will be easy enough to fix once the correct knowledge of the array or object or whatever it is, is in hand.

jdotti’s picture

Subscribe

jdotti’s picture

Hello,

I come back in this issue ...

I try to see the patch attached, but it work whith node.inc file , which is empty now ...

Nobody from the dev team can help us to find the solution of this embarassing problems for i18n websites ?

I would like to debug it , because I know you are full, but i don't know where to start ...
For instance explaining staff like - which files manage node ovveride system. - where in this files, the i18n system is using ... - other help ... in order to start to fix it ...

Thanks in advance and sorry for the spam..

JD

asak’s picture

so that's what's going on...

I was going crazy...

subscribing (and hoping for a solution soon...)

ricolo’s picture

Hi everybody,
Maybe I'm lucky cause I don't understand a lot on what I am doing,
but I delete line 50 on file contexts/node.inc "$reload = TRUE;" (as it was in version 2.0-beta5 of panels) and it seems to work fine now.

Could somenone confirm that ?
And that I am not going on further and stronger issues after that ?

Thanks a lot

asak’s picture

Any progress on this CRITICAL issue?

It might be helpful to know that when using the FAQ module, there seems to be a serious problem with FAQ nodes which don't have a translation. could this mean the problem is somewhere in i18n and not in panels?

jdotti’s picture

Ricolo,

And it is working !
http://drupal.org/node/296919#comment-1124753

Thanks a lot.

The question is why this line exist ...
http://drupal.org/node/343725

JD

asak’s picture

I can confirm that removing the line mentioned in comment #13 solves this issue.

sun’s picture

Title: Panels show wrong node content if translation module is present but no translation for the node in question exists » Wrong/no node content displayed if no translation exists
Version: 5.x-2.0-rc1a » 6.x-2.0-alpha2
Category: support » bug

I simply have to guess that all of you failed to assign the proper version for this issue, as there is no Translation module for 5.x.

The solution is probably to remove the whole if structure here.

cpelham’s picture

Version: 6.x-2.0-alpha2 » 5.x-2.0-rc1a

Sun: In this instance, I correctly filed the issue against Panels version 5.x-2.0-rc1a. The problem relates to its interaction with i18 module, for which there most certainly is a 5.x version, and not Translation module.

sun’s picture

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

Well, if this issue exists in 5.x, then this patch makes absolutely no sense, because there is no Translation module for 5.x and the code changed by this patch is only executed if Translation module is enabled (module_exists('translation')).

cpelham’s picture

The naming conventions of the modules providing multi-lingual support could be more clear, but there is a translation folder (module) WITHIN (i.e. that comes with) the 5.x-2 Internationalization module. Why the module is called Internationalization but the file is called i18n is unclear to me. You will see it if you download it here:
http://ftp.drupal.org/files/projects/i18n-5.x-2.4.tar.gz

I presume that THIS Translation module is what the code is interacting with...

asak’s picture

Yea this is a D5 issue, not D6.

Leeteq’s picture

Title: Wrong/no node content displayed if no translation exists » Wrong/no node content displayed in Panels if no translation exists (i18n)

So this fix goes towards i18n and not Panels?

Leeteq’s picture

Title: Wrong/no node content displayed in Panels if no translation exists (i18n) » Panels/i18n: wrong/no node content displayed if no translation exists
esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

This issue is not going to get fixed in the 2.x line.