MDL-71610 theme_boost: remove edit button from Boost

This commit is contained in:
Bas Brands 2021-07-06 10:19:09 +02:00
parent 09f6ce9fed
commit a0bb51622c
12 changed files with 22 additions and 9 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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()));

View File

@ -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()));

View File

@ -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)) {

View File

@ -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');

View File

@ -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';

View File

@ -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 {

View File

@ -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');

View File

@ -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;

View File

@ -157,3 +157,4 @@ $THEME->scss = function($theme) {
};
$THEME->usefallback = true;
$THEME->iconsystem = '\\theme_classic\\output\\icon_system_fontawesome';
$THEME->haseditswitch = false;

View File

@ -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 {