Merge branch 'MDL-78676-master' of https://github.com/sarjona/moodle
[moodle.git] / theme / boost / templates / language_menu.mustache
blobb3f77d2d9e7a46f83c8dfecf9b7139f5591a8cec
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17 {{!
18     @template theme_boost/language_menu
20     Language menu template.
22     Context variables required for this template:
23     * title - The title of the menu (displays the text of the currently active language).
24     * items - Array of data representing the available languages to be displayed in the language menu.
25        * link - If a link is provided render it.
26          * title - The title of the language item.
27          * text - The text displayed for the language item.
28          * url - The url link to activate the given language.
29          * isactive - Whether the language is currently active.
31     Example context (json):
32     {
33         "title": "English (en)",
34         "items": {
35             "link": {
36                 "title": "English (en)",
37                 "text": "English (en)",
38                 "url": "http://example.com",
39                 "isactive": 0
40             }
41         }
42     }
44 <div class="langmenu">
45     <div class="dropdown show">
46         <a href="#" role="button" id="lang-menu-toggle" data-toggle="dropdown" aria-label="{{#str}}language{{/str}}" aria-haspopup="true" aria-controls="lang-action-menu" class="btn dropdown-toggle">
47             <i class="icon fa fa-language fa-fw mr-1" aria-hidden="true"></i>
48             <span class="langbutton">
49                 {{title}}
50             </span>
51             <b class="caret"></b>
52         </a>
53         <div role="menu" aria-labelledby="lang-menu-toggle" id="lang-action-menu" class="dropdown-menu dropdown-menu-right">
54             {{#items}}
55                 {{#link}}
56                     <a href="{{{url}}}" class="dropdown-item pl-5" role="menuitem" {{#isactive}}aria-current="true"{{/isactive}}
57                             {{#attributes}}{{key}}="{{value}}" {{/attributes}}>
58                         {{text}}
59                     </a>
60                 {{/link}}
61             {{/items}}
62         </div>
63     </div>
64 </div>