See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 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. 8 // 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. 13 // 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/>. 16 namespace mod_bigbluebuttonbn\form; 17 18 use MoodleQuickForm_text; 19 20 defined('MOODLE_INTERNAL') || die(); 21 global $CFG; 22 require_once("$CFG->libdir/form/text.php"); 23 24 /** 25 * Text type form element with a copy widget 26 * 27 * Contains HTML class for a text type element and a link that will copy its content in the copy/paste buffer 28 * 29 * @package mod_bigbluebuttonbn 30 * @copyright 2022 onwards, Blindside Networks Inc 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 * @author Laurent David (laurent [at] call-learning [dt] fr) 33 */ 34 class text_with_copy_element extends MoodleQuickForm_text { 35 /** 36 * Accepts a renderer 37 * 38 * @param object $renderer An HTML_QuickForm_Renderer object 39 * @param bool $required Whether an element is required 40 * @param string $error An error message associated with an element 41 * @return void 42 */ 43 public function accept(&$renderer, $required = false, $error = null) { 44 global $OUTPUT; 45 $elementname = $this->getName(); 46 // Make sure the element has an id. 47 $this->_generateId(); 48 $advanced = isset($renderer->_advancedElements[$elementname]); 49 $elementcontext = $this->export_for_template($OUTPUT); 50 51 $helpbutton = ''; 52 if (method_exists($this, 'getHelpButton')) { 53 $helpbutton = $this->getHelpButton(); 54 } 55 $label = $this->getLabel(); 56 $text = ''; 57 if (method_exists($this, 'getText')) { 58 // There currently exists code that adds a form element with an empty label. 59 // If this is the case then set the label to the description. 60 if (empty($label)) { 61 $label = $this->getText(); 62 } else { 63 $text = $this->getText(); 64 } 65 } 66 67 $context = array( 68 'element' => $elementcontext, 69 'label' => $label, 70 'text' => $text, 71 'required' => $required, 72 'advanced' => $advanced, 73 'helpbutton' => $helpbutton, 74 'error' => $error, 75 'copylabel' => $this->_attributes['copylabel'] ?? get_string('copy', 'core_editor') 76 ); 77 $html = $OUTPUT->render_from_template('mod_bigbluebuttonbn/element_text_with_copy', $context); 78 if ($renderer->_inGroup) { 79 $this->_groupElementTemplate = $html; 80 } 81 if (($renderer->_inGroup) && !empty($renderer->_groupElementTemplate)) { 82 $renderer->_groupElementTemplate = $html; 83 } else if (!isset($renderer->_templates[$elementname])) { 84 $renderer->_templates[$elementname] = $html; 85 } 86 87 if (in_array($elementname, $renderer->_stopFieldsetElements) && $renderer->_fieldsetsOpen > 0) { 88 $renderer->_html .= $renderer->_closeFieldsetTemplate; 89 $renderer->_fieldsetsOpen--; 90 } 91 $renderer->_html .= $html; 92 } 93 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body