b0d5d73063054c86c41e9cced647fffe258fde21
[moodle.git] / lib / form / templates / element-radio.mustache
1 {{!
2     @template theme_boost/core_form/element-radio
4     Example context (json):
5     {
6         "element": {
7             "id": "id_test_radio0",
8             "name": "test_radio_button"
9         }
10     }
12 }}
13 <div class="form-group row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
14     <div class="col-md-3">
15         {{#text}}
16             <label for="{{element.id}}">
17                 {{{label}}}
18             </label>
19         {{/text}}
20     </div>
21     <div class="col-md-9 checkbox">
22         <div class="form-check">
23         <span>
24             <label class="form-check-label">
25                 {{^element.hardfrozen}}{{#element.frozen}}{{#element.checked}}
26                     <input type="hidden" name="{{element.name}}" value="{{element.value}}">
27                 {{/element.checked}}{{/element.frozen}}{{/element.hardfrozen}}
28                 <input type="radio" class="form-check-input" {{^element.frozen}}name="{{element.name}}"{{/element.frozen}}
29                     id="{{element.id}}" value="{{element.value}}"
30                     {{#element.checked}}checked{{/element.checked}}
31                     {{#element.frozen}}disabled{{/element.frozen}}
32                     {{#error}}
33                         autofocus aria-describedby="{{element.iderror}}"
34                     {{/error}} {{{element.attributes}}} >
35                 {{#text}}
36                     {{{.}}}
37                 {{/text}}
38                 {{^text}}
39                     {{{label}}}
40                 {{/text}}
41             </label>
42             {{#required}}<abbr class="initialism text-danger" title="{{#str}}required{{/str}}">{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}</abbr>{{/required}}
43             {{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">!</abbr>{{/advanced}}
44             {{{helpbutton}}}
45             </span>
46         </div>
47         <div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
48             {{{error}}}
49         </div>
50     </div>
51 </div>
52 {{^element.frozen}}
53 {{#js}}
54 require(['theme_boost/form-display-errors'], function(module) {
55     module.enhance({{#quote}}{{element.id}}{{/quote}});
56 });
57 {{/js}}
58 {{/element.frozen}}