diff --git a/theme/bootstrapbase/layout/columns1.php b/theme/bootstrapbase/layout/columns1.php
index 5fad0139f35..7c9a8b39e7a 100644
--- a/theme/bootstrapbase/layout/columns1.php
+++ b/theme/bootstrapbase/layout/columns1.php
@@ -41,11 +41,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/bootstrapbase/layout/columns2.php b/theme/bootstrapbase/layout/columns2.php
index 3a0e69fefaa..a4ecdd46297 100644
--- a/theme/bootstrapbase/layout/columns2.php
+++ b/theme/bootstrapbase/layout/columns2.php
@@ -50,11 +50,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/bootstrapbase/layout/columns3.php b/theme/bootstrapbase/layout/columns3.php
index 1631bb1cdec..7d7341a9e79 100644
--- a/theme/bootstrapbase/layout/columns3.php
+++ b/theme/bootstrapbase/layout/columns3.php
@@ -55,11 +55,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/bootstrapbase/layout/popup.php b/theme/bootstrapbase/layout/popup.php
index ebebf8b2816..2448450f9db 100644
--- a/theme/bootstrapbase/layout/popup.php
+++ b/theme/bootstrapbase/layout/popup.php
@@ -51,11 +51,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
custom_menu(); ?>
diff --git a/theme/bootstrapbase/layout/secure.php b/theme/bootstrapbase/layout/secure.php
index 4d39ae79517..d4399e3945a 100644
--- a/theme/bootstrapbase/layout/secure.php
+++ b/theme/bootstrapbase/layout/secure.php
@@ -54,11 +54,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
- page_heading_menu(); ?>
diff --git a/theme/bootstrapbase/renderers/core_renderer.php b/theme/bootstrapbase/renderers/core_renderer.php
index 68b146e3948..7d1d1517c35 100644
--- a/theme/bootstrapbase/renderers/core_renderer.php
+++ b/theme/bootstrapbase/renderers/core_renderer.php
@@ -91,21 +91,14 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
protected function render_custom_menu(custom_menu $menu) {
global $CFG;
- // TODO: eliminate this duplicated logic, it belongs in core, not
- // here. See MDL-39565.
- $addlangmenu = true;
$langs = get_string_manager()->get_list_of_translations();
- if (count($langs) < 2
- or empty($CFG->langmenu)
- or ($this->page->course != SITEID and !empty($this->page->course->lang))) {
- $addlangmenu = false;
- }
+ $haslangmenu = $this->lang_menu() != '';
- if (!$menu->has_children() && $addlangmenu === false) {
+ if (!$menu->has_children() && !$haslangmenu) {
return '';
}
- if ($addlangmenu) {
+ if ($haslangmenu) {
$strlang = get_string('language');
$currentlang = current_language();
if (isset($langs[$currentlang])) {
@@ -185,6 +178,30 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
return $content;
}
+ /**
+ * This code renders the navbar button to control the display of the custom menu
+ * on smaller screens.
+ *
+ * Do not display the button if the menu is empty.
+ *
+ * @return string HTML fragment
+ */
+ protected function navbar_button() {
+ global $CFG;
+
+ if (empty($CFG->custommenuitems) && $this->lang_menu() == '') {
+ return '';
+ }
+
+ $iconbar = html_writer::tag('span', '', array('class' => 'icon-bar'));
+ $button = html_writer::tag('a', $iconbar . "\n" . $iconbar. "\n" . $iconbar, array(
+ 'class' => 'btn btn-navbar',
+ 'data-toggle' => 'collapse',
+ 'data-target' => '.nav-collapse'
+ ));
+ return $button;
+ }
+
/**
* Renders tabtree
*
diff --git a/theme/clean/layout/columns1.php b/theme/clean/layout/columns1.php
index 15201d86925..1258e048e89 100644
--- a/theme/clean/layout/columns1.php
+++ b/theme/clean/layout/columns1.php
@@ -44,11 +44,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/clean/layout/columns2.php b/theme/clean/layout/columns2.php
index d199bf19dc5..7f57fcb54ee 100644
--- a/theme/clean/layout/columns2.php
+++ b/theme/clean/layout/columns2.php
@@ -53,11 +53,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/clean/layout/columns3.php b/theme/clean/layout/columns3.php
index 47fc02326f5..0b0379408d0 100644
--- a/theme/clean/layout/columns3.php
+++ b/theme/clean/layout/columns3.php
@@ -63,11 +63,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>
user_menu(); ?>
custom_menu(); ?>
diff --git a/theme/clean/layout/secure.php b/theme/clean/layout/secure.php
index d40366f7ba4..5113ae76ef8 100644
--- a/theme/clean/layout/secure.php
+++ b/theme/clean/layout/secure.php
@@ -57,11 +57,7 @@ echo $OUTPUT->doctype() ?>
shortname, true, array('context' => context_course::instance(SITEID)));
?>
-
-
-
-
-
+ navbar_button(); ?>