MDL-55013 core: add support for title

Part of MDL-54987 epic.
This commit is contained in:
Simey Lameze
2016-07-25 10:42:19 +01:00
committed by Dan Poltawski
parent 357ec2d584
commit 858cbfdfd3
5 changed files with 26 additions and 3 deletions
+10 -1
View File
@@ -40,6 +40,7 @@ class chart_base implements JsonSerializable, renderable {
protected $series = [];
protected $labels = [];
protected $title = null;
public function __construct() {
}
@@ -52,7 +53,8 @@ class chart_base implements JsonSerializable, renderable {
return [
'type' => $this->get_type(),
'series' => $this->series,
'labels' => $this->labels
'labels' => $this->labels,
'title' => $this->title
];
}
@@ -64,6 +66,10 @@ class chart_base implements JsonSerializable, renderable {
return $this->series;
}
public function get_title() {
return $this->title;
}
public function get_type() {
$classname = get_class($this);
return substr($classname, strpos($classname, '_') + 1);
@@ -73,4 +79,7 @@ class chart_base implements JsonSerializable, renderable {
$this->labels = $labels;
}
public function set_title($title) {
$this->title = $title;
}
}