MDL-65967 tool_recyclebin: add recycle bin link to category edit menu

This commit is contained in:
Thiagolivramento 2020-03-16 13:42:59 -03:00 committed by Daniel Neis Araujo
parent 9df4a4de18
commit 934ad2c869
2 changed files with 53 additions and 0 deletions

View file

@ -330,6 +330,26 @@ class helper {
'string' => new \lang_string('restorecourse', 'admin')
);
}
// Recyclebyn.
if (\tool_recyclebin\category_bin::is_enabled()) {
$categorybin = new \tool_recyclebin\category_bin($category->id);
if ($categorybin->can_view()) {
$autohide = get_config('tool_recyclebin', 'autohide');
if ($autohide) {
$items = $categorybin->get_items();
} else {
$items = [];
}
if (!$autohide || !empty($items)) {
$pluginname = get_string('pluginname', 'tool_recyclebin');
$actions['recyclebin'] = [
'url' => new \moodle_url('/admin/tool/recyclebin/index.php', ['contextid' => $category->get_context()->id]),
'icon' => new \pix_icon('trash', $pluginname, 'tool_recyclebin'),
'string' => $pluginname
];
}
}
}
return $actions;
}