{{!
    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 mod_bigbluebuttonbn/element_text_with_copy

    This template renders a text input form element with a copy link next to it.

   Context variables required for this template:
    * label
    * required
    * advanced
    * helpbutton
    * error
    * element
        * id
        * name

    Example context (json):
    {
        "label": "Course full name",
        "required": true,
        "advanced": false,
        "error": null,
        "element": {
            "wrapperid": "fitem_id_fullname",
            "id": "id_fullname",
            "name": "fullname",
            "iderror": "id_error"
        }
    }
}}
{{< core_form/element-template }}
    {{$element}}
        <input type="text"
                class="form-control {{#error}}is-invalid{{/error}}"
                name="{{element.name}}"
        {{#element.frozen}}
                readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
        {{/element.frozen}}
                id="{{element.id}}"
                value="{{element.value}}"
                {{#element.size}}size="{{element.size}}"{{/element.size}}
                {{#error}}
                    autofocus aria-describedby="{{element.iderror}}"
                {{/error}}
                {{{element.attributes}}} >
        <button id="{{element.id}}-button"
                data-action="copytoclipboard" data-clipboard-target="#{{element.id}}"
                data-clipboard-success-message="{{#str}}success{{/str}}"
                class="btn btn-link bigbluebuttonbn_icon_btn bigbluebuttonbn_cp_info_btn">
            {{#pix}}t/copy, core{{/pix}} {{copylabel}}
        </button>
    {{/element}}
{{/ core_form/element-template }}
{{#js}}
    require(['core/copy_to_clipboard']);
{{/js}}