public function lang_menu() {
        global $CFG;

        if (empty($CFG->langmenu)) {
            return '';
        }

        if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
            // do not show lang menu if language forced
            return '';
        }

        $currlang = current_language();
        $langs = get_string_manager()->get_list_of_translations();

        if (count($langs) < 2) {
            return '';
        }

        $s = new single_select($this->page->url, 'lang', $langs, $currlang, null);
        $s->label = get_accesshide(get_string('language'));
        $s->class = 'langmenu';
        return $this->render($s);
    }
public function lang_menu() {
        global $CFG;

        if (empty($CFG->langmenu)) {
            return '';
        }

        if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
            // do not show lang menu if language forced
            return '';
        }

        $currlang = current_language();
        $langs = get_string_manager()->get_list_of_translations();

        if (count($langs) < 2) {
            return '';
        }

        $s = new single_select($this->page->url, 'lang', $langs, $currlang, null);
        $s->label = get_accesshide(get_string('language'));
        $s->class = 'langmenu';
        return $this->render($s);
    }
public function lang_menu ( ) { global $ CFG ; if ( empty ( $ CFG -> langmenu ) ) { return '' ; } if ( $ this -> page -> course != SITEID and ! empty ( $ this -> page -> course -> lang ) ) { // do not show lang menu if language forced return '' ; } $ currlang = current_language ( ) ; $ langs = get_string_manager ( ) -> get_list_of_translations ( ) ; if ( count ( $ langs ) < 2 ) { return '' ; } $ s = new single_select ( $ this -> page -> url , 'lang' , $ langs , $ currlang , null ) ; $ s -> label = get_accesshide ( get_string ( 'language' ) ) ; $ s -> class = 'langmenu' ; return $ this -> render ( $ s ) ; }
Returns lang menu or '', this method also checks forcing of languages in courses.

This function calls {@link core_renderer::render_single_select()} to actually display the language menu.

@return string The lang menu HTML or empty string
Returns lang menu or this method also checks forcing of languages in courses .