MDL-76242 core_contentbank: Hide/show unlisted content

This commit is contained in:
Daniel Neis Araujo 2022-11-08 17:18:14 -03:00
parent 554a790bf0
commit 92e10322d4
10 changed files with 120 additions and 6 deletions

View file

@ -122,6 +122,8 @@ class bankcontent implements renderable, templatable {
$method = 'export_tool_'.$tool['action'];
if (method_exists($this, $method)) {
$this->$method($tool);
} else {
$this->export_tool_default($tool);
}
$data->tools[] = $tool;
}
@ -207,4 +209,17 @@ class bankcontent implements renderable, templatable {
$tool['contenttypes'] = $addoptions;
}
/**
* This is the default output of a tool.
* It will be displayed as a button by default.
*
* @param array $tool Data for rendering the Add dropdown, including the editable content types.
* @return void
*/
private function export_tool_default(array &$tool) {
if (empty($tool['checkbox']) && empty($tool['dropdown'])) {
$tool['button'] = true;
}
}
}