A certain module (tinyMCE_NODE_Picker) is using a predefined view to show available nodes to insert into the post as link. After enhancing the view with a language filter ("Current language or none") a strange behaviour occurs. If this view is called through a page, this filter works correctly, and produces a correct QUERY for the selected language (i.e. Slovak, 'SK'):

[CODE]SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node.type AS node_type, node.status AS node_status FROM drupal6_node node WHERE (node.type in ('cck_authority')) AND (node.language in ('sk', '')) ORDER BY node_title ASC LIMIT 0, 10[/CODE]

However, if this views is called from the module using [B]views_embed_view('view_name', 'default');[/B], then the generated query does not reflect the currently set language (SK), and ends up using the following query:

SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node.type AS node_type, node.status AS node_status FROM drupal6_node node WHERE (node.type in ('cck_authority')) AND (node.language in ('en', '')) ORDER BY node_title ASC LIMIT 0, 10

This query is the same as if it was used while the language was English, which is definitely not the case.
I understand that the substitution mechanism should replace '***CURRENT_LANGUAGE***' with $language->language, but for views_embed_view this for whatever reason, does not work. Any help is appreciated!

It is important to point out that caching for this view is completely disabled.

CommentFileSizeAuthor
#5 Clipboard-1.jpg73.54 KBnotabenem
#5 Clipboard-2.jpg66.3 KBnotabenem

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

What happens if the module executes drupal_init_language() before calling the view?

notabenem’s picture

Hi, thank you for the suggestion, but it does not help. It seems it always uses the default language, whatever it is set to (tried changing the default language from en to sk and now I always get sk results, even if lang is set to en).

dawehner’s picture

Is sk the content language or the "global" language which you can set in the user profile of the current user.

notabenem’s picture

en is the "global" language. The content language is undefined for new contents, but even if defined (en or sk) it does not seem to have an effect.

notabenem’s picture

Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new66.3 KB
new73.54 KB

Further refining the issue. So Clipboard-1.jpg shows correct user locale ('en') when the popup appears. However, I want to refine the search using the exposed filters, so I set some criteria. After the refresh (Clipboard-2.jpg), the message says the language is 'sk', which is incorrect. I did not change it to 'sk'.

It seems, that it is enough just to hit the "apply" in the popup window, and the $language->language variable forgets its value ('en') and changes to the default language, which in this case was 'sk'.

Important: before taking these two screenshosts, I changed the Default Language to be 'sk'. At the time of the original post, it was "en".

notabenem’s picture

Another update: the issue is present even if it isn't a popup window.
It can be reproduced just by creating a static page with embedded PHP and putting inside the following:

$content=views_embed_view('nodepicker_nodes', 'default');
echo theme('tinymce_node_picker_page', $content);
 

Because of this I don't think this issue is related to tinyMCE. More likely views or core.

notabenem’s picture

Status: Postponed (maintainer needs more info) » Active
notabenem’s picture

Status: Postponed (maintainer needs more info) » Active

BUMP - Please hint at further steps where to route or how to resolve.

dawehner’s picture

Did you tryed suggestion from http://drupal.org/node/875574#comment-3296238 ?

notabenem’s picture

Yes, I tried that. As it can be seen from comment #2, it did not help and it made the whole thing even worse (I don't recall what was it exactly, but i had to remove it). I repeat, it did not help. Are you able to recreate the issue?

notabenem’s picture

Any ideas on this? I'd be glad to test different setups.

iamjon’s picture

Status: Active » Closed (won't fix)

The module that you are trying to fix has this on it's page
"This module will de discontinued and replaced with Node Picker as soon as a stable release is available."
I suggest you try with the Node Picker module and see if you are still having problems.
If yes, try file an issue with them first.

Good luck

marking as won't fix.

notabenem’s picture

Dear iamjon,
The module I am trying to fix here is not nodepicker, but whatever that is causing that $language->language gets reset to it's default value whenever I hit the "Apply" button on a views exposed filter form. For that reason, I thought starting with views would be a good start.
Are you not able to reproduce this bug?