MDL-72599 blocks: handle editing/deletion on admin notification page.

This was broken by changes in fdd5aef0, as the sesskey URL parameter
was required on admin/index.php in order for block related actions
to be performed uninterrupted by any redirections.
This commit is contained in:
Paul Holden
2021-09-17 12:17:24 +01:00
parent 5ea3545115
commit 8f10f91bf5
+12
View File
@@ -1284,6 +1284,12 @@ class block_manager {
$str = new lang_string('configureblock', 'block', $blocktitle);
$editactionurl = new moodle_url($actionurl, ['bui_editid' => $block->instance->id]);
$editactionurl->remove_params(['sesskey']);
// Handle editing block on admin index page, prevent the page redirecting before block action can begin.
if ($editactionurl->compare(new moodle_url('/admin/index.php'), URL_MATCH_BASE)) {
$editactionurl->param('cache', 1);
}
$controls[] = new action_menu_link_secondary(
$editactionurl,
new pix_icon('t/edit', $str, 'moodle', array('class' => 'iconsmall', 'title' => '')),
@@ -1350,6 +1356,12 @@ class block_manager {
$str = new lang_string('deleteblock', 'block', $blocktitle);
$deleteactionurl = new moodle_url($actionurl, ['bui_deleteid' => $block->instance->id]);
$deleteactionurl->remove_params(['sesskey']);
// Handle deleting block on admin index page, prevent the page redirecting before block action can begin.
if ($deleteactionurl->compare(new moodle_url('/admin/index.php'), URL_MATCH_BASE)) {
$deleteactionurl->param('cache', 1);
}
$controls[] = new action_menu_link_secondary(
$deleteactionurl,
new pix_icon('t/delete', $str, 'moodle', array('class' => 'iconsmall', 'title' => '')),