See Release Notes
Long Term Support Release
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 17 /** 18 * Moodle Component Library 19 * 20 * A sample form with most of the available form elements. 21 * 22 * @package tool_componentlibrary 23 * @copyright 2021 Bas Brands <bas@moodle.com> 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 require_once(__DIR__ . '/../../../../config.php'); 28 require_once($CFG->dirroot.'/lib/formslib.php'); 29 30 require_login(); 31 require_capability('moodle/site:configview', context_system::instance()); 32 33 $repeatcount = optional_param('test_repeat', 1, PARAM_INT); 34 35 $PAGE->set_pagelayout('embedded'); 36 37 $url = new moodle_url('/admin/tool/componentlibrary/examples/formfields.php'); 38 39 $toggles = (object)[]; 40 $toggles->defaulturl = $url; 41 $toggles->helpurl = new moodle_url('/admin/tool/componentlibrary/examples/formfields.php', ['help' => 1]); 42 $toggles->requiredurl = new moodle_url('/admin/tool/componentlibrary/examples/formfields.php', ['required' => 1]); 43 $toggles->bothurl = new moodle_url('/admin/tool/componentlibrary/examples/formfields.php', ['help' => 1, 'required' => 1]); 44 $toggles->mixedurl = new moodle_url('/admin/tool/componentlibrary/examples/formfields.php', 45 ['help' => 1, 'required' => 1, 'mixed' => 1]); 46 47 $PAGE->set_url($url); 48 $PAGE->set_context(context_system::instance()); 49 50 $PAGE->set_heading('Moodle form fields'); 51 $PAGE->set_title('Moodle form fields'); 52 53 $form = new \tool_componentlibrary\local\examples\formelements\example($url, ['repeatcount' => $repeatcount]); 54 55 echo $OUTPUT->header(); 56 57 echo $OUTPUT->render_from_template('tool_componentlibrary/examples/formelements/toggles', $toggles); 58 $form->display(); 59 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body