Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-38979 Add lang menu to empty custommenu

Show custom menu even when no custom menu items if lang menu needs
to be shown.
  • Loading branch information...
commit ea951c5924f4bdd0f36c51aa2caf4b4cb0ceb28c 1 parent cf5a329
David Scotson authored
Showing with 9 additions and 11 deletions.
  1. +9 −11 theme/bootstrapbase/renderers/core.php
View
20 theme/bootstrapbase/renderers/core.php
@@ -67,7 +67,6 @@ public function navbar() {
* Overriding the custom_menu function ensures the custom menu is
* always shown, even if no menu items are configured in the global
* theme settings page.
- * We use the sitename as the first menu item.
*/
public function custom_menu($custommenuitems = '') {
global $CFG;
@@ -85,25 +84,24 @@ public function custom_menu($custommenuitems = '') {
* This renderer is needed to enable the Bootstrap style navigation.
*/
protected function render_custom_menu(custom_menu $menu) {
- // If the menu has no children return an empty string.
- if (!$menu->has_children()) {
- return '';
- }
+ global $CFG;
+
$addlangmenu = true;
$langs = get_string_manager()->get_list_of_translations();
- if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
- // Do not show lang menu if language forced.
+ if (count($langs) < 2
+ or empty($CFG->langmenu)
+ or ($this->page->course != SITEID and !empty($this->page->course->lang))) {
$addlangmenu = false;
}
- if (count($langs) < 2) {
- $addlangmenu = false;
+
+ if (!$menu->has_children() && $addlangmenu === false) {
+ return '';
}
if ($addlangmenu) {
$language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
- $language->add($langname,
- new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
+ $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.