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 17 namespace editor_tiny\plugininfo; 18 19 use moodle_url; 20 21 /** 22 * Subplugin info class. 23 * 24 * @package editor_tiny 25 * @copyright 2022 Andrew Lyons <andrew@nicols.co.uk> 26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 27 */ 28 class tiny extends \core\plugininfo\base { 29 30 /** 31 * These subplugins can be uninstalled. 32 * 33 * @return bool 34 */ 35 public function is_uninstall_allowed(): bool { 36 return true; 37 } 38 39 /** 40 * Return URL used for management of plugins of this type. 41 * 42 * @return moodle_url 43 */ 44 public static function get_manage_url(): moodle_url { 45 return new moodle_url('/admin/settings.php', [ 46 'section' => 'editorsettingstiny', 47 ]); 48 } 49 50 /** 51 * Include the settings.php file from subplugins if provided. 52 * 53 * This is a copy of very similar implementations from various other subplugin areas. 54 * 55 * @param \part_of_admin_tree $adminroot 56 * @param string $parentnodename 57 * @param bool $hassiteconfig whether the current user has moodle/site:config capability 58 */ 59 public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig): void { 60 // In case settings.php wants to refer to them. 61 global $CFG, $USER, $DB, $OUTPUT, $PAGE; 62 63 $ADMIN = $adminroot; // May be used in settings.php. 64 $plugininfo = $this; // Also can be used inside settings.php. 65 66 if (!$this->is_installed_and_upgraded()) { 67 return; 68 } 69 70 if (!$hassiteconfig || !file_exists($this->full_path('settings.php'))) { 71 return; 72 } 73 74 $section = $this->get_settings_section_name(); 75 $settings = new \admin_settingpage( 76 $section, 77 $this->displayname, 78 'moodle/site:config', 79 $this->is_enabled() === false 80 ); 81 82 // This may also set $settings to null. 83 include($this->full_path('settings.php')); 84 85 if ($settings) { 86 $ADMIN->add($parentnodename, $settings); 87 } 88 } 89 90 /** 91 * Get the settings section name. 92 * This is used to get the setting links in the Tiny sub-plugins table. 93 * 94 * @return null|string the settings section name. 95 */ 96 public function get_settings_section_name(): ?string { 97 return "tiny_{$this->name}_settings"; 98 } 99 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body