File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magefan ([email protected] ). All rights reserved.
4
+ * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magefan \Blog \Block ;
10
+
11
+ use Magefan \Blog \Block \Post \View \Opengraph ;
12
+ class CustomCss extends Opengraph
13
+ {
14
+
15
+ /**
16
+ * Render html output
17
+ *
18
+ * @return string
19
+ */
20
+ protected function _toHtml ()
21
+ {
22
+ $ css = $ this ->config ->getCustomCss ();
23
+ return $ css ? ('<style> ' . $ css . '</style> ' ) : '' ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ class Config
112
112
const XML_INCLUDE_BLOG_CSS_ALL_PAGES = 'mfblog/developer/css_settings/include_all_pages ' ;
113
113
const XML_INCLUDE_BLOG_CSS_HOME_PAGE = 'mfblog/developer/css_settings/include_home_page ' ;
114
114
const XML_INCLUDE_BLOG_CSS_PRODUCT_PAGES = 'mfblog/developer/css_settings/include_product_page ' ;
115
+ const XML_BLOG_CUSTOM_CSS = 'mfblog/developer/css_settings/custom_css ' ;
115
116
116
117
/**
117
118
* @var ScopeConfigInterface
@@ -288,4 +289,13 @@ public function getPagePaginationType($storeId = null)
288
289
289
290
return 'page ' ;
290
291
}
292
+
293
+ /**
294
+ * @param $storeId
295
+ * @return string
296
+ */
297
+ public function getCustomCss ($ storeId = null ): string
298
+ {
299
+ return (string )$ this ->getConfig (self ::XML_BLOG_CUSTOM_CSS , $ storeId );
300
+ }
291
301
}
Original file line number Diff line number Diff line change 679
679
<field id =" include_all_pages" >0</field >
680
680
</depends >
681
681
</field >
682
+ <field id =" custom_css" translate =" label" type =" textarea" sortOrder =" 30" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
683
+ <label >Custom CSS</label >
684
+ </field >
682
685
</group >
683
686
</group >
684
687
</section >
Original file line number Diff line number Diff line change 13
13
<css src =" Magefan_Blog::css/blog-new.css" />
14
14
<css src =" Magefan_Blog::css/blog-custom.css" />
15
15
</head >
16
+ <body >
17
+ <referenceContainer name =" content" >
18
+ <block class =" Magefan\Blog\Block\CustomCss" name =" magefan.blog.custom.css" />
19
+ </referenceContainer >
20
+ </body >
16
21
</page >
You can’t perform that action at this time.
0 commit comments