summaryrefslogtreecommitdiffstats
path: root/library/Reporting/Web/Widget/CoverPage.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Reporting/Web/Widget/CoverPage.php')
-rw-r--r--library/Reporting/Web/Widget/CoverPage.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/library/Reporting/Web/Widget/CoverPage.php b/library/Reporting/Web/Widget/CoverPage.php
index 545ef6a..5b95a45 100644
--- a/library/Reporting/Web/Widget/CoverPage.php
+++ b/library/Reporting/Web/Widget/CoverPage.php
@@ -5,6 +5,7 @@ namespace Icinga\Module\Reporting\Web\Widget;
use Icinga\Module\Reporting\Common\Macros;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
+use ipl\Web\Compat\StyleWithNonce;
class CoverPage extends BaseHtmlElement
{
@@ -138,15 +139,22 @@ class CoverPage extends BaseHtmlElement
protected function assemble()
{
if ($this->hasBackgroundImage()) {
- $this
- ->getAttributes()
- ->add('style', "background-image: url('" . Template::getDataUrl($this->getBackgroundImage()) . "');");
+ $coverPageBackground = (new StyleWithNonce())
+ ->setModule('reporting')
+ ->addFor($this, [
+ 'background-image' => sprintf("url('%s')", Template::getDataUrl($this->getBackgroundImage()))
+ ]);
+
+ $this->addHtml($coverPageBackground);
}
$content = Html::tag('div', ['class' => 'cover-page-content']);
-
if ($this->hasColor()) {
- $content->getAttributes()->add('style', "color: {$this->getColor()};");
+ $coverPageLogo = (new StyleWithNonce())
+ ->setModule('reporting')
+ ->addFor($content, ['color' => $this->getColor()]);
+
+ $content->addHtml($coverPageLogo);
}
if ($this->hasLogo()) {