diff --git a/admin/category.php b/admin/category.php index b203497bfeb..b0a682eb5a3 100644 --- a/admin/category.php +++ b/admin/category.php @@ -75,7 +75,7 @@ if ($PAGE->user_allowed_editing() && $adminediting != -1) { $USER->editing = $adminediting; } $buttons = null; -if ($PAGE->user_allowed_editing()) { +if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) { $url = clone($PAGE->url); if ($PAGE->user_is_editing()) { $caption = get_string('blockseditoff'); diff --git a/admin/settings.php b/admin/settings.php index 24b90244dc9..a3d48fc48c9 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -101,7 +101,7 @@ if (empty($SITE->fullname)) { echo $OUTPUT->render_from_template('core_admin/settings', $context); } else { - if ($PAGE->user_allowed_editing()) { + if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) { $url = clone($PAGE->url); if ($PAGE->user_is_editing()) { $caption = get_string('blockseditoff'); diff --git a/lib/adminlib.php b/lib/adminlib.php index d25dbfd4a07..9f13db277ca 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -8836,7 +8836,7 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa $visiblepathtosection = array_reverse($extpage->visiblepath); - if ($PAGE->user_allowed_editing()) { + if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) { if ($PAGE->user_is_editing()) { $caption = get_string('blockseditoff'); $url = new moodle_url($PAGE->url, array('adminedit'=>'0', 'sesskey'=>sesskey())); diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 7249f9e784f..5d8e1e39ed4 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -5434,7 +5434,7 @@ class settings_navigation extends navigation_node { } $frontpage->id = 'frontpagesettings'; - if ($this->page->user_allowed_editing()) { + if ($this->page->user_allowed_editing() && !$this->page->theme->haseditswitch) { // Add the turn on/off settings $url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey())); diff --git a/lib/outputlib.php b/lib/outputlib.php index bfc93a0d6cc..0462b35173e 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -754,7 +754,7 @@ class theme_config { 'rendererfactory', 'csspostprocess', 'editor_sheets', 'editor_scss', 'rarrow', 'larrow', 'uarrow', 'darrow', 'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations', 'blockrendermethod', 'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition', - 'iconsystem', 'precompiledcsscallback'); + 'iconsystem', 'precompiledcsscallback', 'haseditswitch'); foreach ($config as $key=>$value) { if (in_array($key, $configurable)) { diff --git a/mod/book/lib.php b/mod/book/lib.php index 6f13bbc9d81..bc130833750 100644 --- a/mod/book/lib.php +++ b/mod/book/lib.php @@ -346,7 +346,9 @@ function book_extend_settings_navigation(settings_navigation $settingsnav, navig $url = new moodle_url('/mod/book/view.php', array('id'=>$params['id'], 'chapterid'=>$params['chapterid'], 'edit'=>$edit, 'sesskey'=>sesskey())); $editnode = navigation_node::create($string, $url, navigation_node::TYPE_SETTING); $booknode->add_node($editnode, $firstkey); - $PAGE->set_button($OUTPUT->single_button($url, $string)); + if (!$PAGE->theme->haseditswitch) { + $PAGE->set_button($OUTPUT->single_button($url, $string)); + } } $plugins = core_component::get_plugin_list('booktool'); diff --git a/mod/data/view.php b/mod/data/view.php index a50662d5721..6f22273b5e4 100644 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -231,7 +231,7 @@ // The code will be much nicer than this eventually. $title = $courseshortname.': ' . format_string($data->name); - if ($PAGE->user_allowed_editing()) { + if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) { // Change URL parameter and block display string value depending on whether editing is enabled or not if ($PAGE->user_is_editing()) { $urlediting = 'off'; diff --git a/my/index.php b/my/index.php index 331954b73c9..fe684a6bba8 100644 --- a/my/index.php +++ b/my/index.php @@ -155,7 +155,10 @@ if (empty($CFG->forcedefaultmymoodle) && $PAGE->user_allowed_editing()) { } $url = new moodle_url("$CFG->wwwroot/my/index.php", $params); - $button = $OUTPUT->single_button($url, $editstring); + $button = ''; + if (!$PAGE->theme->haseditswitch) { + $button = $OUTPUT->single_button($url, $editstring); + } $PAGE->set_button($resetbutton . $button); } else { diff --git a/theme/boost/classes/output/core_renderer.php b/theme/boost/classes/output/core_renderer.php index e5ad7952896..d9d4cff1730 100644 --- a/theme/boost/classes/output/core_renderer.php +++ b/theme/boost/classes/output/core_renderer.php @@ -32,6 +32,9 @@ defined('MOODLE_INTERNAL') || die; class core_renderer extends \core_renderer { public function edit_button(moodle_url $url) { + if ($this->page->theme->haseditswitch) { + return; + } $url->param('sesskey', sesskey()); if ($this->page->user_is_editing()) { $url->param('edit', 'off'); diff --git a/theme/boost/config.php b/theme/boost/config.php index 4f1682d7a09..6db5d20c210 100644 --- a/theme/boost/config.php +++ b/theme/boost/config.php @@ -157,3 +157,4 @@ $THEME->rendererfactory = 'theme_overridden_renderer_factory'; $THEME->requiredblocks = ''; $THEME->addblockposition = BLOCK_ADDBLOCK_POSITION_FLATNAV; $THEME->iconsystem = \core\output\icon_system::FONTAWESOME; +$THEME->haseditswitch = true; diff --git a/theme/classic/config.php b/theme/classic/config.php index c636e8ecf1b..da34422bc66 100644 --- a/theme/classic/config.php +++ b/theme/classic/config.php @@ -157,3 +157,4 @@ $THEME->scss = function($theme) { }; $THEME->usefallback = true; $THEME->iconsystem = '\\theme_classic\\output\\icon_system_fontawesome'; +$THEME->haseditswitch = false; diff --git a/user/profile.php b/user/profile.php index 907d986d2ad..aa272bc01ec 100644 --- a/user/profile.php +++ b/user/profile.php @@ -184,7 +184,10 @@ if ($PAGE->user_allowed_editing()) { } $url = new moodle_url("$CFG->wwwroot/user/profile.php", $params); - $button = $OUTPUT->single_button($url, $editstring); + $button = ''; + if (!$PAGE->theme->haseditswitch) { + $button = $OUTPUT->single_button($url, $editstring); + } $PAGE->set_button($resetbutton . $button); } else {