Skip to content
Snippets Groups Projects
Commit 5df8aa77 authored by AlexisWilke's avatar AlexisWilke
Browse files

Update to support i18n with InsertNode in Drupal 6.

parent 77115e04
Branches
Tags
No related merge requests found
......@@ -12,7 +12,7 @@
* Function used to replace the [node:...] tags.
*/
function _InsertNode_replacer($matches) {
global $_InsertNode_demote_level;
global $_InsertNode_demote_level, $language;
static $insert_node_count = 0;
static $node_ids = array();
......@@ -38,7 +38,12 @@ function _InsertNode_replacer($matches) {
}
}
$node = node_load($nid);
// first try with the language to support i18n sites
$node = node_load(array('tnid' => $nid, 'language' => $language->language));
if (!$node) {
// if the load fails with the language, try again without
$node = node_load(array('nid' => $nid));
}
if ($nid && node_access('view', $node)) {
// avoid recursivity
if (!empty($node_ids[$nid])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment