Merge branch 'wip-MDL-56586-master-2' of git://github.com/marinaglancy/moodle
This commit is contained in:
@@ -3764,6 +3764,25 @@ 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() &&
|
||||
($addable = $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);
|
||||
$blocks = [];
|
||||
foreach ($addable as $block) {
|
||||
$blocks[] = $block->name;
|
||||
}
|
||||
$params = array('blocks' => $blocks, 'url' => '?' . $url->get_query_string(false));
|
||||
$PAGE->requires->js_call_amd('core/addblockmodal', 'init', array($params));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user