1441 |
ariadna |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
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.
|
|
|
8 |
|
|
|
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.
|
|
|
13 |
|
|
|
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_admin/setting_configtoggle
|
|
|
19 |
|
|
|
20 |
Template for toggle element in admin settings.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* id - element id
|
|
|
24 |
* checked - bool, true if the toggle is enabled
|
|
|
25 |
* name - form element name
|
|
|
26 |
* value - form for name field
|
|
|
27 |
* action - action to be performed when the toggle is clicked
|
|
|
28 |
* plugin - plugin name
|
|
|
29 |
* state - state of the toggle
|
|
|
30 |
* title - title of the toggle tooltip
|
|
|
31 |
* label - label of the toggle
|
|
|
32 |
* labelclasses - classes for the label (visually-hidden for screen readers)
|
|
|
33 |
|
|
|
34 |
Example context (json):
|
|
|
35 |
{
|
|
|
36 |
"id": "reality-toggle-3",
|
|
|
37 |
"checked": true,
|
|
|
38 |
"dataattributes": [{
|
|
|
39 |
"name": "id",
|
|
|
40 |
"value": "toggle-reality",
|
|
|
41 |
"action": "togglestate",
|
|
|
42 |
"plugin": "tool_reality",
|
|
|
43 |
"state": 1
|
|
|
44 |
}],
|
|
|
45 |
"title": "Title example",
|
|
|
46 |
"label": "Enable/disable reality",
|
|
|
47 |
"labelclasses": "visually-hidden"
|
|
|
48 |
}
|
|
|
49 |
}}
|
|
|
50 |
<div id="container-{{id}}"
|
|
|
51 |
data-toggle-method="{{dataattributes.toggle-method}}"
|
|
|
52 |
data-action="{{dataattributes.action}}"
|
|
|
53 |
data-plugin="{{dataattributes.plugin}}"
|
|
|
54 |
data-state="{{dataattributes.state}}"
|
|
|
55 |
data-value="{{dataattributes.value}}"
|
|
|
56 |
>
|
|
|
57 |
{{> core/toggle }}
|
|
|
58 |
</div>
|
|
|
59 |
|