{{!
    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 theme_foundation/editswitch

    This template renders the edit switch.

    Example context (json):
    {
        "legacyseturl": "http://localhost/",
        "pagecontextid": "",
        "pageurl": "http://localhost/",
        "sesskey": "sesskey",
        "checked": "",
        "uniqid": ""
    }
}}
<form action="{{{legacyseturl}}}" method="post" class="editmode-switch-form" title="{{#str}}editmode{{/str}}">
    <div class="input-group">
        <div class="form-check form-switch">
            <input type="checkbox"{{!
                }} name="setmode"{{!
                }}{{#checked}}{{!
                    }} aria-checked="true" checked{{!
                }}{{/checked}}{{!
                }}{{^checked}}{{!
                    }} aria-checked="false"{{!
                }}{{/checked}}{{!
                }} class="form-check-input"{{!
                }} id="{{uniqid}}-editingswitch"{{!
                }} data-context="{{{pagecontextid}}}"{{!
                }} data-pageurl="{{{pageurl}}}"{{!
                }} title="{{#str}}editmode{{/str}}"{{!
                }} aria-label="{{#str}}editmode{{/str}}"{{!
            }}>
            <span class="form-check-label"></span>
        </div>
    </div>
    <input type="hidden" name="sesskey" value="{{{sesskey}}}">
    <input type="hidden" name="pageurl" value="{{{pageurl}}}">
    <input type="hidden" name="context" value="{{{pagecontextid}}}">
    <noscript>
        <input type="submit" value="{{#str}}setmode, core{{/str}}">
    </noscript>
</form>
{{#js}}
require(['core/edit_switch'], function(editSwitch) {
    editSwitch.init('{{uniqid}}-editingswitch');
});
{{/js}}
