MDL-68636 core_contentbank: Changing get_icon function

This commit is contained in:
Amaia Anabitarte 2020-05-06 10:11:35 +02:00
parent f9830e456a
commit 6fc3477cc5
7 changed files with 81 additions and 16 deletions

View file

@ -181,12 +181,12 @@ abstract class contenttype {
/**
* Returns the HTML code to render the icon for content bank contents.
*
* @param string $contentname The contentname to add as alt value to the icon.
* @param content $content The content to be displayed.
* @return string HTML code to render the icon
*/
public function get_icon(string $contentname): string {
public function get_icon(content $content): string {
global $OUTPUT;
return $OUTPUT->pix_icon('f/unknown-64', $contentname, 'moodle', ['class' => 'iconsize-big']);
return $OUTPUT->image_url('f/unknown-64', 'moodle')->out(false);
}
/**

View file

@ -86,7 +86,7 @@ class bankcontent implements renderable, templatable {
$contentdata[] = array(
'name' => $name,
'link' => $contenttype->get_view_url($content),
'icon' => $contenttype->get_icon($name)
'icon' => $contenttype->get_icon($content)
);
}
$data->contents = $contentdata;