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/>.
18 @template core_form/element-select
20 Simple select form element template.
22 Context variables required for this template:
24 * nameraw - Raw Element name without '[]'
25 * name - Element name,
26 * label - Element label,
27 * multiple - multi select?,
29 * error - Is there an error associated with this element?,
30 * size - Element size,
31 * value - Element value,
32 * helpbutton - Helpbutton,
33 * hiddenlabel - Element hidden flag,
34 * frozen - Element frozen flag,
35 * hardfrozen - Element hard fronzen flag,
36 * extraclasses - Extra classes assocaited,
37 * type - Element type,
38 * attributes - Element attributes,
45 optionattributes - Option attributes
49 Example context (json):
52 "id": "id_maildisplay",
53 "nameraw": "maildisplay",
54 "name": "maildisplay",
74 "optionattributes": ""
77 "text": "Visible to everyone",
81 "optionattributes": ""
84 "text": "Allow only other course members to see my email address",
88 "optionattributes": ""
94 {{< core_form/element-template }}
98 <input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
100 <select class="{{^element.multiple}}custom-select{{/element.multiple}}
101 {{#element.multiple}}form-control{{/element.multiple}}
102 {{#error}}is-invalid{{/error}}"
103 name="{{element.name}}"
105 {{#element.multiple}}multiple{{/element.multiple}}
106 {{#element.size}}size="{{element.size}}"{{/element.size}}
108 autofocus aria-describedby="{{element.iderror}}"
110 {{{element.attributes}}} >
112 <option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}}
113 {{{optionattributes}}}>{{{text}}}</option>
121 {{^element.hardfrozen}}
122 <input type="hidden" name="{{element.name}}" value="{{value}}" id="{{element.id}}">
123 {{/element.hardfrozen}}
128 {{/ core_form/element-template }}