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/single_button
20 Moodle template for a single button submit form.
22 Classes required for JS:
25 Data attributes required for JS:
28 Context variables required for this template:
29 * classes - a list of classes to wrap the form.
30 * method - get or post
31 * url - the action url to submit to
32 * formid - optional id value for the form
33 * params - array of params with name and value attributes
34 * id - id for the element
35 * type - type for the element
36 * tooltip - tooltip text for the button
37 * disabled - true if this element is disabled
38 * label - text to show on the button
40 Example context (json):
46 "tooltip" : "This is a tooltip",
47 "label" : "This is a the button text",
50 "name": "data-attribute",
56 <div class="{{classes}}">
57 <form method="{{method}}" action="{{url}}" {{#formid}}id="{{formid}}"{{/formid}}>
59 <input type="hidden" name="{{name}}" value="{{value}}">
61 <button type="submit" class="btn btn-{{type}}"
63 {{#tooltip}}title="{{tooltip}}"{{/tooltip}}
64 {{#disabled}}disabled{{/disabled}}
65 {{#attributes}} {{name}}="{{value}}" {{/attributes}}>{{label}}</button>