From 17abefd8ea044071489bfe3ea1dec72102f104c8 Mon Sep 17 00:00:00 2001 From: Gareth Barnard <1058419+gjb2048@users.noreply.github.com> Date: Sat, 30 Mar 2024 13:10:49 +0000 Subject: [PATCH] V402.1.0 --- .github/workflows/ci.yml | 2 +- Changes.md | 6 ++++++ classes/output/external.php | 19 ++++++++++++------- settings.php | 30 ++++++++++++++---------------- version.php | 8 ++++---- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c00265..11f2708 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: fail-fast: true matrix: php: ['8.0', '8.2'] - moodle-branch: ['MOODLE_403_STABLE'] + moodle-branch: ['MOODLE_402_STABLE', 'main'] database: [mariadb] steps: diff --git a/Changes.md b/Changes.md index 29d8c31..eff65f9 100644 --- a/Changes.md +++ b/Changes.md @@ -1,5 +1,11 @@ Version Information =================== + +Version 402.1.0 - TBR +-------------------------- +1. Improve settings UI. +2. Minimal version is now M4.2 - due to changes in core external API and to make use of tabs for settings. + Version 39.1.2 - 08/10/23 -------------------------- 1. Add missing 'pluginname' from language file. diff --git a/classes/output/external.php b/classes/output/external.php index c017cc7..718c0b0 100644 --- a/classes/output/external.php +++ b/classes/output/external.php @@ -25,6 +25,11 @@ namespace filter_synhi\output; +use core_external\external_api; +use core_external\external_function_parameters; +use core_external\external_single_structure; +use core_external\external_value; + /** * SynHi filter. * @@ -33,7 +38,7 @@ * @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ -class external extends \core\output\external { +class external extends external_api { /** * Return generated markup. * @@ -66,11 +71,11 @@ public static function setting_highlight_example($engine, $style) { * @return external_function_parameters */ public static function setting_highlight_example_parameters() { - return new \external_function_parameters( + return new external_function_parameters( [ - 'engine' => new \external_value(PARAM_TEXT, 'Engine', VALUE_REQUIRED, null, NULL_NOT_ALLOWED), - 'style' => new \external_value(PARAM_TEXT, 'Style', VALUE_REQUIRED, null, NULL_NOT_ALLOWED), - ] + 'engine' => new external_value(PARAM_TEXT, 'Engine', VALUE_REQUIRED, null, NULL_NOT_ALLOWED), + 'style' => new external_value(PARAM_TEXT, 'Style', VALUE_REQUIRED, null, NULL_NOT_ALLOWED), + ] ); } @@ -80,9 +85,9 @@ public static function setting_highlight_example_parameters() { * @return external_description */ public static function setting_highlight_example_returns() { - return new \external_single_structure( + return new external_single_structure( [ - 'markup' => new \external_value(PARAM_RAW, 'Markup'), + 'markup' => new external_value(PARAM_RAW, 'Markup'), ], 'Mustache template' ); diff --git a/settings.php b/settings.php index b46d4a5..0070eaf 100644 --- a/settings.php +++ b/settings.php @@ -24,16 +24,14 @@ */ defined('MOODLE_INTERNAL') || die; -$settings = null; -$ADMIN->add('filtersettings', new admin_category('filter_synhi', get_string('filtername', 'filter_synhi'))); - -// Information. -$page = new admin_settingpage( - 'filter_synhi_information', - get_string('information', 'filter_synhi') -); - if ($ADMIN->fulltree) { + $settings = new theme_boost_admin_settingspage_tabs('filtersettingsynhi', get_string('filtername', 'filter_synhi')); + + // Information. + $page = new admin_settingpage( + 'filter_synhi_information', + get_string('information', 'filter_synhi') + ); $page->add(new admin_setting_heading( 'filter_synhi_information', '', @@ -41,7 +39,7 @@ )); // Information. - $page->add(new \filter_synhi\admin_setting_information('filter_synhi/formatinformation', '', '', 39, 403)); + $page->add(new \filter_synhi\admin_setting_information('filter_synhi/formatinformation', '', '', 402, 404)); // Readme.md. $page->add(new \filter_synhi\admin_setting_markdown('filter_synhi/filterreadme', '', '', 'Readme.md', 'filter/synhi')); @@ -54,12 +52,11 @@ 'Changes.md', 'filter/synhi' )); -} -$ADMIN->add('filter_synhi', $page); -// Settings. -$page = new admin_settingpage('filter_synhi_settings', get_string('settings', 'filter_synhi')); -if ($ADMIN->fulltree) { + $settings->add($page); + + // Settings. + $page = new admin_settingpage('filter_synhi_settings', get_string('settings', 'filter_synhi')); // Engine. $name = 'filter_synhi/engine'; $title = get_string('engine', 'filter_synhi'); @@ -144,5 +141,6 @@ 'syntaxhighlighterinformation', '

' . get_string('syntaxhighlighterinformation', 'filter_synhi') . '

' )); + + $settings->add($page); } -$ADMIN->add('filter_synhi', $page); diff --git a/version.php b/version.php index 2b4a249..63061b2 100644 --- a/version.php +++ b/version.php @@ -25,9 +25,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2020073108; -$plugin->requires = 2020061500.00; // M3.9 (Build: 20200615). -$plugin->supported = [39, 403]; +$plugin->version = 2024033000; +$plugin->requires = 2023042400.00; // 4.2 (Build: 20230424). +$plugin->supported = [402, 404]; $plugin->component = 'filter_synhi'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '39.1.2'; +$plugin->release = '402.1.0';