mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-67810 core_contentbank: added dropdown menu to create content
This commit is contained in:
parent
68fd8d8bdf
commit
75f58cbfa2
16 changed files with 437 additions and 14 deletions
|
@ -62,6 +62,19 @@ $foldercontents = $cb->search_contents($search, $contextid, $contenttypes);
|
|||
|
||||
// Get the toolbar ready.
|
||||
$toolbar = array ();
|
||||
|
||||
// Place the Add button in the toolbar.
|
||||
if (has_capability('moodle/contentbank:useeditor', $context)) {
|
||||
// Get the content types for which the user can use an editor.
|
||||
$editabletypes = $cb->get_contenttypes_with_capability_feature(\core_contentbank\contenttype::CAN_EDIT, $context);
|
||||
if (!empty($editabletypes)) {
|
||||
// Editor base URL.
|
||||
$editbaseurl = new moodle_url('/contentbank/edit.php', ['contextid' => $contextid]);
|
||||
$toolbar[] = ['name' => get_string('add'), 'link' => $editbaseurl, 'dropdown' => true, 'contenttypes' => $editabletypes];
|
||||
}
|
||||
}
|
||||
|
||||
// Place the Upload button in the toolbar.
|
||||
if (has_capability('moodle/contentbank:upload', $context)) {
|
||||
// Don' show upload button if there's no plugin to support any file extension.
|
||||
$accepted = $cb->get_supported_extensions_as_string($context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue