mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-56809-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
4b2790c580
1 changed files with 93 additions and 1 deletions
|
@ -1,3 +1,94 @@
|
||||||
|
{{!
|
||||||
|
This file is part of Moodle - http://moodle.org/
|
||||||
|
|
||||||
|
Moodle is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Moodle is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
}}
|
||||||
|
{{!
|
||||||
|
@template core_form/element-select
|
||||||
|
|
||||||
|
Simple select form element template.
|
||||||
|
|
||||||
|
Context variables required for this template:
|
||||||
|
* id - Element id,
|
||||||
|
* name - Element name,
|
||||||
|
* label - Element label,
|
||||||
|
* multiple - multi select?,
|
||||||
|
* checked - checked?,
|
||||||
|
* error - Is there an error associated with this element?,
|
||||||
|
* size - Element size,
|
||||||
|
* value - Element value,
|
||||||
|
* helpbutton - Helpbutton,
|
||||||
|
* hiddenlabel - Element hidden flag,
|
||||||
|
* frozen - Element frozen flag,
|
||||||
|
* hardfrozen - Element hard fronzen flag,
|
||||||
|
* extraclasses - Extra classes assocaited,
|
||||||
|
* type - Element type,
|
||||||
|
* attributes - Element attributes,
|
||||||
|
* options - [
|
||||||
|
{
|
||||||
|
text - Option text,
|
||||||
|
value - Option value,
|
||||||
|
selected - Selected?,
|
||||||
|
disabled - Disabled?,
|
||||||
|
optionattributes - Option attributes
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Example context (json):
|
||||||
|
{
|
||||||
|
"element": {
|
||||||
|
"id": "id_maildisplay",
|
||||||
|
"name": "maildisplay",
|
||||||
|
"label": null,
|
||||||
|
"multiple": null,
|
||||||
|
"checked": null,
|
||||||
|
"error": null,
|
||||||
|
"size": null,
|
||||||
|
"value": null,
|
||||||
|
"helpbutton": "",
|
||||||
|
"hiddenlabel": false,
|
||||||
|
"frozen": false,
|
||||||
|
"hardfrozen": false,
|
||||||
|
"extraclasses": null,
|
||||||
|
"type": "select",
|
||||||
|
"attributes": "",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"text": "Hide my email address from everyone",
|
||||||
|
"value": 0,
|
||||||
|
"selected": false,
|
||||||
|
"disabled": false,
|
||||||
|
"optionattributes": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Allow everyone to see my email address",
|
||||||
|
"value": 1,
|
||||||
|
"selected": true,
|
||||||
|
"disabled": false,
|
||||||
|
"optionattributes": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Allow only other course members to see my email address",
|
||||||
|
"value": 2,
|
||||||
|
"selected": false,
|
||||||
|
"disabled": false,
|
||||||
|
"optionattributes": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
{{< core_form/element-template }}
|
{{< core_form/element-template }}
|
||||||
{{$element}}
|
{{$element}}
|
||||||
{{^element.frozen}}
|
{{^element.frozen}}
|
||||||
|
@ -12,7 +103,8 @@
|
||||||
{{/error}}
|
{{/error}}
|
||||||
{{{element.attributes}}} >
|
{{{element.attributes}}} >
|
||||||
{{#element.options}}
|
{{#element.options}}
|
||||||
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}} {{{optionattributes}}}>{{text}}</option>
|
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}}
|
||||||
|
{{{optionattributes}}}>{{{text}}}</option>
|
||||||
{{/element.options}}
|
{{/element.options}}
|
||||||
</select>
|
</select>
|
||||||
{{/element.frozen}}
|
{{/element.frozen}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue