MDL-55701 output: Adding core template for help_icon

We didn't intend to do this, but as I made the mistake of extending
core/help_icon in a core template without realising that it
works solely because I had that template in the new theme, I
decided to add this template to core too.

Part of MDL-55071
This commit is contained in:
Frederic Massart
2016-09-23 10:53:56 +01:00
committed by Dan Poltawski
parent ecfad63d28
commit a84eadb88e
3 changed files with 34 additions and 33 deletions
+11
View File
@@ -499,6 +499,8 @@ class help_icon implements renderable, templatable {
* @return array
*/
public function export_for_template(renderer_base $output) {
global $CFG;
$title = get_string($this->identifier, $this->component);
if (empty($this->linktext)) {
@@ -508,7 +510,16 @@ class help_icon implements renderable, templatable {
}
$data = get_formatted_help_string($this->identifier, $this->component, false);
$data->alt = $alt;
$data->icon = (new pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($output);
$data->linktext = $this->linktext;
$data->title = get_string('helpprefix2', '', trim($title, ". \t"));
$data->url = (new moodle_url($CFG->httpswwwroot . '/help.php', [
'component' => $this->component,
'identifier' => $this->identifier,
'lang' => current_language()
]))->out(false);
$data->ltr = !right_to_left();
return $data;