-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathCustomCss.php
More file actions
48 lines (41 loc) · 1.1 KB
/
CustomCss.php
File metadata and controls
48 lines (41 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Copyright © Magefan (support@magefan.com). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/
declare(strict_types=1);
namespace Magefan\Blog\Block;
class CustomCss extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magefan\Blog\Model\Config
*/
private $config;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magefan\Blog\Model\Config $config
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magefan\Blog\Model\Config $config,
array $data = []
) {
$this->config = $config;
parent::__construct($context, $data);
}
/**
* Render html output
*
* @return string
*/
protected function _toHtml()
{
if ($this->config->isEnabled()) {
if ($css = $this->config->getCustomCss()) {
return '<style>' . $css . '</style>';
}
}
return '';
}
}