diff --git a/search/classes/document.php b/search/classes/document.php index 85e116f6872..1ee3d3c5414 100644 --- a/search/classes/document.php +++ b/search/classes/document.php @@ -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(); diff --git a/search/templates/result.mustache b/search/templates/result.mustache index 4b5c7d8f433..7b055ca3c55 100644 --- a/search/templates/result.mustache +++ b/search/templates/result.mustache @@ -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" } }}

- {{#icon}}{{/icon}}{{{title}}} + {{#iconname}} + {{#pix}}{{iconname}}, {{iconcomponent}}{{/pix}} + {{/iconname}} + {{{title}}}

{{#content}}
{{{content}}}