MDL-66849 output: Remove custom menu title when not specified
[moodle.git] / lib / templates / custom_menu_item.mustache
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/>.
16 }}
17 {{!
18     @template core/custom_menu_item
20     This template renders a node as part of a submenu.
22     Example context (json):
23     {
24         "divider": "",
25         "haschildren": "1",
26         "uniqid": "Unique string",
27         "text": "Moodle community",
28         "children": "[custom_menu_item object]",
29         "title": "Moodle community",
30         "url": "https://moodle.org"
31     }
32 }}
33 {{^divider}}
34 {{#haschildren}}
35 <li class="dropdown nav-item">
36     <a class="dropdown-toggle nav-link" id="drop-down-{{uniqid}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" {{#title}}title="{{{title}}}"{{/title}} aria-controls="drop-down-menu-{{uniqid}}">
37         {{{text}}}
38     </a>
39     <div class="dropdown-menu" role="menu" id="drop-down-menu-{{uniqid}}" aria-labelledby="drop-down-{{uniqid}}">
40         {{#children}}
41             {{^divider}}
42                 <a class="dropdown-item" role="menuitem" href="{{{url}}}" {{#title}}title="{{{title}}}"{{/title}}>{{{text}}}</a>
43             {{/divider}}
44             {{#divider}}
45                 <div class="dropdown-divider" role="presentation"></div>
46             {{/divider}}
47         {{/children}}
48     </div>
49 </li>
50 {{/haschildren}}
51 {{^haschildren}}
52 <li class="nav-item">
53     <a class="nav-item nav-link" href="{{{url}}}" {{#title}}title="{{{title}}}"{{/title}}>{{{text}}}</a>
54 </li>
55 {{/haschildren}}
56 {{/divider}}