summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Carver2017-10-06 05:14:25 -0500
committerMark Carver2017-10-06 05:14:25 -0500
commit85b09470a3b84840638e5706a93d14ca9bdd97f7 (patch)
tree7b3772fda7c6db562fb032d0931c48f79ee82253
parent135aa79f983b60851ebaf4ce8042cc3be7fe3e28 (diff)
Issue #1761934 by webnicola, markcarver, RollWhisTler: Translate menu using internationalization module (i18n)7.x-3.16
-rw-r--r--templates/system/page.vars.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/templates/system/page.vars.php b/templates/system/page.vars.php
index a7fcafc..035e8ef 100644
--- a/templates/system/page.vars.php
+++ b/templates/system/page.vars.php
@@ -32,17 +32,22 @@ function bootstrap_preprocess_page(&$variables) {
$variables['container_class'] = 'container';
}
+ $i18n = module_exists('i18n_menu');
+
// Primary nav.
$variables['primary_nav'] = FALSE;
if ($variables['main_menu']) {
// Load the tree
$tree = menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu'));
+
// Localize the tree.
- if (module_exists('i18n_menu')) {
+ if ($i18n) {
$tree = i18n_menu_localize_tree($tree);
}
+
// Build links.
$variables['primary_nav'] = menu_tree_output($tree);
+
// Provide default theme wrapper function.
$variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
}
@@ -50,8 +55,17 @@ function bootstrap_preprocess_page(&$variables) {
// Secondary nav.
$variables['secondary_nav'] = FALSE;
if ($variables['secondary_menu']) {
+ // Load the tree
+ $tree = menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu'));
+
+ // Localize the tree.
+ if ($i18n) {
+ $tree = i18n_menu_localize_tree($tree);
+ }
+
// Build links.
- $variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
+ $variables['secondary_nav'] = menu_tree_output($tree);
+
// Provide default theme wrapper function.
$variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
}