MDL-24777 new renderable component pix_emoticon
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user