mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-56586 blocks: allow theme to manage "Add a block" select
This commit is contained in:
parent
692c1bf345
commit
b11916d3e7
8 changed files with 140 additions and 18 deletions
|
@ -3764,6 +3764,19 @@ class flat_navigation extends navigation_node_collection {
|
|||
$flat->key = 'sitesettings';
|
||||
$this->add($flat);
|
||||
}
|
||||
|
||||
// Add-a-block in editing mode.
|
||||
if (isset($this->page->theme->addblockposition) &&
|
||||
$this->page->theme->addblockposition == BLOCK_ADDBLOCK_POSITION_FLATNAV &&
|
||||
$PAGE->user_is_editing() && $PAGE->user_can_edit_blocks() &&
|
||||
$PAGE->blocks->get_addable_blocks()) {
|
||||
$url = new moodle_url($PAGE->url, ['bui_addblock' => '', 'sesskey' => sesskey()]);
|
||||
$addablock = navigation_node::create(get_string('addblock'), $url);
|
||||
$flat = new flat_navigation_node($addablock, 0);
|
||||
$flat->set_showdivider(true);
|
||||
$flat->key = 'addblock';
|
||||
$this->add($flat);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue