MDL-24777 new renderable component pix_emoticon

This commit is contained in:
David Mudrak
2010-10-23 18:39:23 +00:00
parent cd3059b122
commit d63c507370
2 changed files with 28 additions and 0 deletions
+17
View File
@@ -338,6 +338,23 @@ class pix_icon implements renderable {
}
}
/**
* Data structure representing an emoticon image
*
* @since Moodle 2.0
*/
class pix_emoticon extends pix_icon implements renderable {
/**
* Constructor
* @param string $pix short icon name
* @param string $component component name
*/
public function __construct($pix, $alt, $component = 'moodle') {
$attributes = array('class' => 'emoticon');
parent::__construct($pix, $alt, $component, $attributes);
}
}
/**
* Data structure representing a simple form with only one button.
+11
View File
@@ -1358,6 +1358,17 @@ class core_renderer extends renderer_base {
return html_writer::empty_tag('img', $attributes);
}
/**
* Render emoticon
* @param pix_emoticon $emoticon
* @return string HTML fragment
*/
protected function render_pix_emoticon(pix_emoticon $emoticon) {
$attributes = $emoticon->attributes;
$attributes['src'] = $this->pix_url($emoticon->pix, $emoticon->component);
return html_writer::empty_tag('img', $attributes);
}
/**
* Produces the html that represents this rating in the UI
* @param $page the page object on which this rating will appear