diff options
Diffstat (limited to 'plugins/CoreVisualizations')
3 files changed, 11 insertions, 2 deletions
diff --git a/plugins/CoreVisualizations/Visualizations/Sparklines.php b/plugins/CoreVisualizations/Visualizations/Sparklines.php index fac492c30a..0407259221 100644 --- a/plugins/CoreVisualizations/Visualizations/Sparklines.php +++ b/plugins/CoreVisualizations/Visualizations/Sparklines.php @@ -72,6 +72,7 @@ class Sparklines extends ViewDataTable $view->sparklines = $this->config->getSortedSparklines(); $view->isWidget = Common::getRequestVar('widget', 0, 'int'); + $view->titleAttributes = $this->config->title_attributes; $view->title = ''; if ($this->config->show_title) { diff --git a/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php b/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php index ca54a6d564..70100f6896 100644 --- a/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php +++ b/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php @@ -33,6 +33,13 @@ class Config extends \Piwik\ViewDataTable\Config */ private $sparklines = array(); + /** + * Adds possibility to set html attributes on the sparklines title / headline. For example can be used + * to set an angular directive + * @var string + */ + public $title_attributes = array(); + public function __construct() { parent::__construct(); diff --git a/plugins/CoreVisualizations/templates/_dataTableViz_sparklines.twig b/plugins/CoreVisualizations/templates/_dataTableViz_sparklines.twig index 4ed2dbc655..cf4c655fce 100644 --- a/plugins/CoreVisualizations/templates/_dataTableViz_sparklines.twig +++ b/plugins/CoreVisualizations/templates/_dataTableViz_sparklines.twig @@ -3,8 +3,9 @@ {% if not isWidget %} <div class="card"><div class="card-content"> {% endif %} - {% if title is not empty %}<h2 class="card-title">{{ title }}</h2>{% endif %} - + {% if title is not empty %}<h2 class="card-title" + {% if titleAttributes is not empty %}{% for attribute, value in titleAttributes %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %} + >{{ title }}</h2>{% endif %} {% if not isWidget %} <div class="row"> <div class="col m6"> |