MDL-81589 search: Use pix method to display global search icons
Rather than exclusively relying on the image icon in the global search documents, the 'pix' method is used now, which allows to incorporate FontAwesome icons whenever they're available.
This commit is contained in:
@@ -686,6 +686,8 @@ class document implements \renderable, \templatable {
|
||||
if ($docicon = $this->get_doc_icon()) {
|
||||
$data['icon'] = $output->image_url($docicon->get_name(), $docicon->get_component());
|
||||
$data['iconurl'] = $data['icon']->out(false);
|
||||
$data['iconname'] = $docicon->get_name();
|
||||
$data['iconcomponent'] = $docicon->get_component();
|
||||
}
|
||||
$data['textformat'] = $this->get_text_format();
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
* contextid
|
||||
* userid
|
||||
* timemodified
|
||||
* iconname
|
||||
* iconcomponent
|
||||
* icon
|
||||
* iconurl
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
@@ -61,12 +65,16 @@
|
||||
[
|
||||
"file1.txt",
|
||||
"file2.txt"
|
||||
]
|
||||
],
|
||||
"iconname": "i/customfield"
|
||||
}
|
||||
}}
|
||||
<div class="result">
|
||||
<h4 class="result-title">
|
||||
{{#icon}}<img class="icon" alt="" src="{{{icon}}}">{{/icon}}<a href="{{{docurl}}}">{{{title}}}</a>
|
||||
{{#iconname}}
|
||||
{{#pix}}{{iconname}}, {{iconcomponent}}{{/pix}}
|
||||
{{/iconname}}
|
||||
<a href="{{{docurl}}}">{{{title}}}</a>
|
||||
</h4>
|
||||
{{#content}}
|
||||
<div class="result-content">{{{content}}}</div>
|
||||
|
||||
Reference in New Issue
Block a user