From 81827126c55b7a7b74a74c3c3407d4f5708415d9 Mon Sep 17 00:00:00 2001 From: Christian Wolters <christian.wolters@uni-luebeck.de> Date: Mon, 13 Jul 2020 16:42:41 +0200 Subject: [PATCH] Deleted own additional edit button for courses because upstream Boost reimplemented it. --- CHANGES.md | 2 ++ README.md | 4 ---- classes/output/core_renderer.php | 22 ------------------- db/upgrade.php | 9 ++++++++ lang/en/theme_boost_campus.php | 3 --- settings.php | 7 ------ ...oost_campus_course_layout_settings.feature | 11 ---------- version.php | 2 +- 8 files changed, 12 insertions(+), 48 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1c402d8..b41e08d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,8 @@ Changes ### Unreleased +* 2020-09-02 - Deleted own additional edit button for courses because upstream Boost reimplemented it. + Many thanks to @christianwolters for providing this fix. * 2020-09-02 - Prepare compatibility for Moodle 3.9. ### Release v3.8-r5 diff --git a/README.md b/README.md index 65ae853..f24b5ce 100644 --- a/README.md +++ b/README.md @@ -121,10 +121,6 @@ With this setting you can manage where the "Add a block" widget should be displa This setting can change the behaviour Moodle displays the title for the first course section. Moodle does not display it as long as the default title for this section is set. As soon as a user changes the title, it will appear. With this setting (option is checked), you can achieve a consistent behaviour by always showing the title for section 0. -#### Course edit button - -With this setting you can add an additional course edit on / off button to the course header for faster accessibility. This the same way as it was displayed before theme_boost. - #### Course related hints ##### Position of switch role information diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index 63a3575..7eb3f69 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -60,28 +60,6 @@ defined('MOODLE_INTERNAL') || die; */ class core_renderer extends \core_renderer { - /** - * Override to display an edit button again by calling the parent function - * in core/core_renderer because theme_boost's function returns an empty - * string and therefore displays nothing. - * - * MODIFICATION: This renderer function is copied and modified from /theme/boost/classes/output/core_renderer.php - * - * @param moodle_url $url The current course url. - * @return \core_renderer::edit_button Moodle edit button. - */ - public function edit_button(moodle_url $url) { - // MODIFICATION START. - // If setting editbuttonincourseheader ist checked give out the edit on / off button in course header. - if (get_config('theme_boost_campus', 'courseeditbutton') == '1') { - return \core_renderer::edit_button($url); - } - // MODIFICATION END. - /* ORIGINAL START. - return ''; - ORIGINAL END. */ - } - /** * Override to add additional class for the random login image to the body. * diff --git a/db/upgrade.php b/db/upgrade.php index 2c37566..450c692 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -73,5 +73,14 @@ function xmldb_theme_boost_campus_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2020030800, 'theme', 'boost_campus'); } + if ($oldversion < 2020082801) { + // The setting "theme_boost_campus|courseeditbutton" has been removed because the setting was + // reimplemented in Boost core. + // Therefore we remove this setting in the database. + set_config('courseeditbutton', null, 'theme_boost_campus'); + + upgrade_plugin_savepoint(true, 2020082801, 'theme', 'boost_campus'); + } + return true; } diff --git a/lang/en/theme_boost_campus.php b/lang/en/theme_boost_campus.php index bec69e9..fc33a89 100644 --- a/lang/en/theme_boost_campus.php +++ b/lang/en/theme_boost_campus.php @@ -67,9 +67,6 @@ $string['courselayoutsettings'] = 'Course Layout Settings'; // ...Section 0. $string['section0titlesetting'] = 'Section 0: Title'; $string['section0titlesetting_desc'] = 'This setting can change the behaviour Moodle displays the title for the first course section. Moodle does not display it as long as the default title for this section is set. As soon as a user changes the title, it will appear. With this setting (option is checked), you can achieve a consistent behaviour by always showing the title for section 0.'; -// ...Course edit button. -$string['courseeditbuttonsetting'] = 'Course edit button'; -$string['courseeditbuttonsetting_desc'] = 'With this setting you can add an additional course edit on / off button to the course header for faster accessibility of this often used function.'; // ...Course related hints. $string['coursehintsheadingsetting'] = 'Course related hints.'; // ...Switch role information. diff --git a/settings.php b/settings.php index 0ced88d..7702db9 100644 --- a/settings.php +++ b/settings.php @@ -245,13 +245,6 @@ if ($ADMIN->fulltree) { $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); - // Setting for displaying edit on / off button addionally in course header. - $name = 'theme_boost_campus/courseeditbutton'; - $title = get_string('courseeditbuttonsetting', 'theme_boost_campus', null, true); - $description = get_string('courseeditbuttonsetting_desc', 'theme_boost_campus', null, true); - $setting = new admin_setting_configcheckbox($name, $title, $description, 0); - $page->add($setting); - // Settings title for grouping course settings related aspects together. We don't need a description here. $name = 'theme_boost_campus/coursehintsheading'; $title = get_string('coursehintsheadingsetting', 'theme_boost_campus', null, true); diff --git a/tests/behat/theme_boost_campus_course_layout_settings.feature b/tests/behat/theme_boost_campus_course_layout_settings.feature index 53a6469..dd38653 100644 --- a/tests/behat/theme_boost_campus_course_layout_settings.feature +++ b/tests/behat/theme_boost_campus_course_layout_settings.feature @@ -42,17 +42,6 @@ Feature: Configuring the theme_boost_campus plugin for the "Course Layout settin | New value for Section name | This is the general section | Then I should see "This is the general section" in the "li#section-0" "css_element" - Scenario: Enable "Course edit button" - Given the following config values are set as admin: - | config | value | plugin | - | courseeditbutton | 1 | theme_boost_campus | - When I log in as "teacher1" - And I am on "Course 1" course homepage - Then I should see "Turn editing on" in the "#page-header .singlebutton" "css_element" - When I click on "Turn editing on" "button" - Then I should see "Turn editing off" in the "#page-header .singlebutton" "css_element" - And I should see "Add an activity or resource" - Scenario: Enable "Position of switch role information" Given the following config values are set as admin: | config | value | plugin | diff --git a/version.php b/version.php index 694ebea..3a25bee 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'theme_boost_campus'; -$plugin->version = 2020090100; +$plugin->version = 2020090101; $plugin->release = 'v3.8-r5'; $plugin->requires = 2020061500; $plugin->maturity = MATURITY_STABLE; -- GitLab