original_string: public function custom_menu_flat() {
          global $CFG;
          $custommenuitems = '';
  
          if (empty($custommenuitems) && !empty($CFG->custommenuitems)) {
              $custommenuitems = $CFG->custommenuitems;
          }
          $custommenu = new custom_menu($custommenuitems, current_language());
          $langs = get_string_manager()->get_list_of_translations();
          $haslangmenu = $this->lang_menu() != '';
  
          if ($haslangmenu) {
              $strlang = get_string('language');
              $currentlang = current_language();
              if (isset($langs[$currentlang])) {
                  $currentlang = $langs[$currentlang];
              } else {
                  $currentlang = $strlang;
              }
              $this->language = $custommenu->add($currentlang, new moodle_url('#'), $strlang, 10000);
              foreach ($langs as $langtype => $langname) {
                  $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
              }
          }
  
          return $custommenu->export_for_template($this);
      }
code: public function custom_menu_flat() {
          global $CFG;
          $custommenuitems = '';
  
          if (empty($custommenuitems) && !empty($CFG->custommenuitems)) {
              $custommenuitems = $CFG->custommenuitems;
          }
          $custommenu = new custom_menu($custommenuitems, current_language());
          $langs = get_string_manager()->get_list_of_translations();
          $haslangmenu = $this->lang_menu() != '';
  
          if ($haslangmenu) {
              $strlang = get_string('language');
              $currentlang = current_language();
              if (isset($langs[$currentlang])) {
                  $currentlang = $langs[$currentlang];
              } else {
                  $currentlang = $strlang;
              }
              $this->language = $custommenu->add($currentlang, new moodle_url('#'), $strlang, 10000);
              foreach ($langs as $langtype => $langname) {
                  $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
              }
          }
  
          return $custommenu->export_for_template($this);
      }
code_tokens: public function custom_menu_flat ( ) { global $ CFG ; $ custommenuitems = '' ; if ( empty ( $ custommenuitems ) && ! empty ( $ CFG -> custommenuitems ) ) { $ custommenuitems = $ CFG -> custommenuitems ; } $ custommenu = new custom_menu ( $ custommenuitems , current_language ( ) ) ; $ langs = get_string_manager ( ) -> get_list_of_translations ( ) ; $ haslangmenu = $ this -> lang_menu ( ) != '' ; if ( $ haslangmenu ) { $ strlang = get_string ( 'language' ) ; $ currentlang = current_language ( ) ; if ( isset ( $ langs [ $ currentlang ] ) ) { $ currentlang = $ langs [ $ currentlang ] ; } else { $ currentlang = $ strlang ; } $ this -> language = $ custommenu -> add ( $ currentlang , new moodle_url ( '#' ) , $ strlang , 10000 ) ; foreach ( $ langs as $ langtype => $ langname ) { $ this -> language -> add ( $ langname , new moodle_url ( $ this -> page -> url , array ( 'lang' => $ langtype ) ) , $ langname ) ; } } return $ custommenu -> export_for_template ( $ this ) ; }
docstring: We want to show the custom menus as a list of links in the footer on small screens.
  Just return the menu object exported so we can render it differently.
docstring_tokens: We want to show the custom menus as a list of links in the footer on small screens . Just return the menu object exported so we can render it differently .