461 |
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_form/element-template
|
|
|
19 |
|
|
|
20 |
Template for the form element wrapper template.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* label
|
|
|
24 |
* required
|
|
|
25 |
* advanced
|
|
|
26 |
* helpbutton
|
|
|
27 |
* error
|
|
|
28 |
* element
|
|
|
29 |
* id
|
|
|
30 |
* name
|
|
|
31 |
|
|
|
32 |
Example context (json):
|
|
|
33 |
{
|
|
|
34 |
"label": "Course full name",
|
|
|
35 |
"required": true,
|
|
|
36 |
"advanced": false,
|
|
|
37 |
"error": null,
|
|
|
38 |
"element": {
|
|
|
39 |
"wrapperid": "fitem_id_fullname",
|
|
|
40 |
"id": "id_fullname",
|
|
|
41 |
"name": "fullname"
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
}}
|
1044 |
ariadna |
45 |
<div id="{{element.wrapperid}}" class="form-group position-relative mb-3 {{#error}}has-danger{{/error}} fitem {{#element.emptylabel}}femptylabel col-12{{/element.emptylabel}} {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}} {{{element.parentclasses}}}" {{#element.groupname}}data-groupname="{{.}}"{{/element.groupname}}>
|
|
|
46 |
<div class="col-form-label mb-1">
|
461 |
ariadna |
47 |
{{# label}}{{$ label }}
|
|
|
48 |
{{^element.staticlabel}}
|
1045 |
ariadna |
49 |
<p id="{{element.id}}_label" class="d-inline {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
|
461 |
ariadna |
50 |
{{{label}}}
|
1045 |
ariadna |
51 |
</p>
|
461 |
ariadna |
52 |
{{/element.staticlabel}}
|
|
|
53 |
{{#element.staticlabel}}
|
|
|
54 |
<label class="d-inline-block {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}">
|
|
|
55 |
{{{label}}}
|
|
|
56 |
</label>
|
|
|
57 |
{{/element.staticlabel}}
|
|
|
58 |
{{/ label }}{{/ label}}
|
|
|
59 |
<sup class="sup">
|
|
|
60 |
{{#required}}<span title="{{#str}}required{{/str}}" class="rui-req-icon">{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}</span>{{/required}}
|
|
|
61 |
{{{helpbutton}}}
|
|
|
62 |
</sup>
|
|
|
63 |
</div>
|
1164 |
ariadna |
64 |
<div class="form-inline felement px-0 justify-content-center" data-fieldtype="{{element.type}}">
|
461 |
ariadna |
65 |
{{$ element }}
|
|
|
66 |
<!-- Element goes here -->
|
|
|
67 |
{{/ element }}
|
|
|
68 |
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
|
|
|
69 |
{{{error}}}
|
|
|
70 |
</div>
|
|
|
71 |
</div>
|
|
|
72 |
</div>
|
|
|
73 |
{{#js}}
|
|
|
74 |
require(['theme_universe/form-display-errors'], function(module) {
|
|
|
75 |
module.enhance({{#quote}}{{element.id}}{{/quote}});
|
|
|
76 |
});
|
|
|
77 |
{{/js}}
|