Skip to content

Commit cf9dd2d

Browse files
committed
update for the Magento 2.2.x
1 parent 1a85b1c commit cf9dd2d

File tree

21 files changed

+261
-119
lines changed

21 files changed

+261
-119
lines changed

Block/Category/Category.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @Author Ngo Quang Cuong <[email protected]>
66
* @Date 2016-12-20 23:13:15
77
* @Last modified by: nquangcuong
8-
* @Last Modified time: 2017-01-06 08:14:36
8+
* @Last Modified time: 2017-11-11 20:23:49
99
*/
1010

1111
namespace PHPCuong\Faq\Block\Category;
@@ -16,6 +16,7 @@
1616
use PHPCuong\Faq\Helper\Config as ConfigHelper;
1717
use PHPCuong\Faq\Model\ResourceModel\Faq as FaqResourceModel;
1818
use PHPCuong\Faq\Model\ResourceModel\Faqcat as FaqCatResourceModel;
19+
use Magento\Cms\Model\Template\FilterProvider;
1920

2021
class Category extends \Magento\Framework\View\Element\Template
2122
{
@@ -49,6 +50,11 @@ class Category extends \Magento\Framework\View\Element\Template
4950
*/
5051
protected $_faqCategoryIcon = null;
5152

53+
/**
54+
* @var \Magento\Cms\Model\Template\FilterProvider
55+
*/
56+
protected $filterProvider;
57+
5258
/**
5359
* @param Context $context
5460
* @param StoreManagerInterface $storeManager
@@ -57,18 +63,21 @@ class Category extends \Magento\Framework\View\Element\Template
5763
* @param FaqCatResourceModel $faqCatResourceModel
5864
* @param FaqResourceModel $faqResourceModel
5965
* @param ConfigHelper $configHelper
66+
* @param FilterProvider $filterProvider
6067
*/
6168
public function __construct(
6269
Context $context,
6370
CategoryHelper $categoryHelper,
6471
FaqCatResourceModel $faqCatResourceModel,
6572
FaqResourceModel $faqResourceModel,
66-
ConfigHelper $configHelper
73+
ConfigHelper $configHelper,
74+
FilterProvider $filterProvider
6775
) {
6876
$this->_categoryHelper = $categoryHelper;
6977
$this->_faqCatResourceModel = $faqCatResourceModel;
7078
$this->_faqResourceModel = $faqResourceModel;
7179
$this->_configHelper = $configHelper;
80+
$this->filterProvider = $filterProvider;
7281
parent::__construct($context);
7382
}
7483

@@ -129,6 +138,19 @@ protected function _prepareLayout()
129138
return parent::_prepareLayout();
130139
}
131140

141+
/**
142+
* Filter provider
143+
*
144+
* @param string $content
145+
* @return string
146+
*/
147+
public function filterProvider($content)
148+
{
149+
return $this->filterProvider->getBlockFilter()
150+
->setStoreId($this->_storeManager->getStore()->getId())
151+
->filter($content);
152+
}
153+
132154
/**
133155
* Get Category Icon
134156
*

Block/Faq/Faq.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @Author Ngo Quang Cuong <[email protected]>
66
* @Date 2016-12-23 18:16:21
77
* @Last modified by: nquangcuong
8-
* @Last Modified time: 2017-11-11 14:20:19
8+
* @Last Modified time: 2017-11-11 20:11:48
99
*/
1010

1111
namespace PHPCuong\Faq\Block\Faq;
@@ -16,6 +16,7 @@
1616
use PHPCuong\Faq\Model\ResourceModel\Faq as FaqResourceModel;
1717
use Magento\Framework\App\Filesystem\DirectoryList;
1818
use PHPCuong\Faq\Helper\Config as ConfigHelper;
19+
use Magento\Cms\Model\Template\FilterProvider;
1920

2021
class Faq extends \Magento\Framework\View\Element\Template
2122
{
@@ -50,6 +51,11 @@ class Faq extends \Magento\Framework\View\Element\Template
5051
*/
5152
protected $_configHelper;
5253

54+
/**
55+
* @var \Magento\Cms\Model\Template\FilterProvider
56+
*/
57+
protected $filterProvider;
58+
5359
/**
5460
*
5561
* @param Context $context
@@ -58,20 +64,23 @@ class Faq extends \Magento\Framework\View\Element\Template
5864
* @param DirectoryList $directoryList
5965
* @param FaqResourceModel $faqResourceModel
6066
* @param ConfigHelper $configHelper
67+
* @param FilterProvider $filterProvider
6168
*/
6269
public function __construct(
6370
Context $context,
6471
QuestionHelper $questionHelper,
6572
CategoryHelper $categoryHelper,
6673
DirectoryList $directoryList,
6774
FaqResourceModel $faqResourceModel,
68-
ConfigHelper $configHelper
75+
ConfigHelper $configHelper,
76+
FilterProvider $filterProvider
6977
) {
7078
$this->_questionHelper = $questionHelper;
7179
$this->_categoryHelper = $categoryHelper;
7280
$this->_directoryList = $directoryList;
7381
$this->_faqResourceModel = $faqResourceModel;
7482
$this->_configHelper = $configHelper;
83+
$this->filterProvider = $filterProvider;
7584
parent::__construct($context);
7685
}
7786

@@ -111,6 +120,19 @@ protected function _prepareLayout()
111120
return parent::_prepareLayout();
112121
}
113122

123+
/**
124+
* Filter provider
125+
*
126+
* @param string $content
127+
* @return string
128+
*/
129+
public function filterProvider($content)
130+
{
131+
return $this->filterProvider->getBlockFilter()
132+
->setStoreId($this->_storeManager->getStore()->getId())
133+
->filter($content);
134+
}
135+
114136
/**
115137
* Get the questions most frequently
116138
*

Block/Question/Question.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @Author Ngo Quang Cuong <[email protected]>
66
* @Date 2016-12-18 15:27:53
77
* @Last modified by: nquangcuong
8-
* @Last Modified time: 2017-01-06 08:13:53
8+
* @Last Modified time: 2017-11-11 20:24:37
99
*/
1010

1111
namespace PHPCuong\Faq\Block\Question;
@@ -14,6 +14,7 @@
1414
use PHPCuong\Faq\Helper\Question as QuestionHelper;
1515
use PHPCuong\Faq\Model\ResourceModel\Faq;
1616
use PHPCuong\Faq\Helper\Config as ConfigHelper;
17+
use Magento\Cms\Model\Template\FilterProvider;
1718

1819
class Question extends \Magento\Framework\View\Element\Template
1920
{
@@ -67,22 +68,43 @@ class Question extends \Magento\Framework\View\Element\Template
6768
*/
6869
protected $_faqId = null;
6970

71+
/**
72+
* @var \Magento\Cms\Model\Template\FilterProvider
73+
*/
74+
protected $filterProvider;
75+
7076
/**
7177
*
7278
* @param Context $context
7379
* @param QuestionHelper $questionHelper
7480
* @param ConfigHelper $configHelper
81+
* @param FilterProvider $filterProvider
7582
*/
7683
public function __construct(
7784
Context $context,
7885
QuestionHelper $questionHelper,
79-
ConfigHelper $configHelper
86+
ConfigHelper $configHelper,
87+
FilterProvider $filterProvider
8088
) {
8189
$this->_questionHelper = $questionHelper;
8290
$this->_configHelper = $configHelper;
91+
$this->filterProvider = $filterProvider;
8392
parent::__construct($context);
8493
}
8594

95+
/**
96+
* Filter provider
97+
*
98+
* @param string $content
99+
* @return string
100+
*/
101+
public function filterProvider($content)
102+
{
103+
return $this->filterProvider->getBlockFilter()
104+
->setStoreId($this->_storeManager->getStore()->getId())
105+
->filter($content);
106+
}
107+
86108
/**
87109
* Get the list of questions
88110
*

view/adminhtml/layout/phpcuong_faq_edit.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,9 @@
3737
</action>
3838
</block>
3939
</referenceContainer>
40+
<referenceContainer name="legal.copyright">
41+
<block class="Magento\Backend\Block\Page\Copyright" name="faq-copyright" template="PHPCuong_Faq::footer/copyright.phtml"/>
42+
</referenceContainer>
43+
<referenceBlock name="copyright" remove="true"/>
4044
</body>
4145
</page>

view/adminhtml/layout/phpcuong_faq_index.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@
2121
<referenceContainer name="content">
2222
<uiComponent name="faq_listing"/>
2323
</referenceContainer>
24+
<referenceContainer name="legal.copyright">
25+
<block class="Magento\Backend\Block\Page\Copyright" name="faq-copyright" template="PHPCuong_Faq::footer/copyright.phtml"/>
26+
</referenceContainer>
27+
<referenceBlock name="copyright" remove="true"/>
2428
</body>
2529
</page>

view/adminhtml/layout/phpcuong_faqcat_edit.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@
3232
</action>
3333
</block>
3434
</referenceContainer>
35+
<referenceContainer name="legal.copyright">
36+
<block class="Magento\Backend\Block\Page\Copyright" name="faq-copyright" template="PHPCuong_Faq::footer/copyright.phtml"/>
37+
</referenceContainer>
38+
<referenceBlock name="copyright" remove="true"/>
3539
</body>
3640
</page>

view/adminhtml/layout/phpcuong_faqcat_index.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@
2121
<referenceContainer name="content">
2222
<uiComponent name="faqcat_listing"/>
2323
</referenceContainer>
24+
<referenceContainer name="legal.copyright">
25+
<block class="Magento\Backend\Block\Page\Copyright" name="faq-copyright" template="PHPCuong_Faq::footer/copyright.phtml"/>
26+
</referenceContainer>
27+
<referenceBlock name="copyright" remove="true"/>
2428
</body>
2529
</page>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
echo base64_decode('PHN0eWxlPg0KICAgIC5jb3B5cmlnaHQuY29sLW0tNiBzcGFuLmNvcHlyaWdodCB7DQogICAgICAgIGZvbnQtc2l6ZTogMTAwJTsNCiAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDsNCiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOw0KICAgIH0NCiAgICAuY29weXJpZ2h0LmNvbC1tLTYgc3Bhbi5jb3B5cmlnaHQgc3BhbiB7DQogICAgICAgIHBhZGRpbmctbGVmdDogMzVweDsNCiAgICAgICAgZm9udC1zaXplOiAxMDAlOw0KICAgIH0NCiAgICAuY29weXJpZ2h0LmNvbC1tLTYgc3Bhbi5jb3B5cmlnaHQ6YmVmb3JlIHsNCiAgICAgICAgY29udGVudDogIlxlOTAxIjsNCiAgICAgICAgZm9udC1mYW1pbHk6ICdmYXEtZXh0ZW5zaW9uJzsNCiAgICAgICAgbWFyZ2luLXJpZ2h0OiAxNXB4Ow0KICAgICAgICBjb2xvcjogI2IxNDY3MTsNCiAgICAgICAgZm9udC1zaXplOiAzMHB4Ow0KICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7DQogICAgICAgIHRvcDogLTEwcHg7DQogICAgICAgIGxlZnQ6IDBweDsNCiAgICAgICAgZGlzcGxheTogYmxvY2s7DQogICAgfQ0KICAgIC5jb3B5cmlnaHQuY29sLW0tNiBzcGFuIHsNCiAgICAgICAgZGlzcGxheTogYmxvY2s7DQogICAgICAgIGZvbnQtc2l6ZTogMTJweDsNCiAgICB9DQogICAgLmNvcHlyaWdodC5jb2wtbS02IHNwYW4gYSB7DQogICAgICAgIGNvbG9yOiAjZWY2NzJmOw0KICAgIH0NCiAgICAuY29weXJpZ2h0LmNvbC1tLTYgLnNreXBlIHsNCiAgICAgICAgcGFkZGluZy10b3A6IDVweDsNCiAgICB9DQo8L3N0eWxlPg0KPHNwYW4gY2xhc3M9ImNvcHlyaWdodCI+PHNwYW4+Q29weXJpZ2h0IMKpIDIwMTctMjAxOCA8YSBocmVmPSJodHRwczovL3d3dy5mYWNlYm9vay5jb20vZ2lhcGh1Z3JvdXBjb20iIHRhcmdldD0iX2JsYW5rIiB0aXRsZT0iR2lhUGh1R3JvdXAgTHRkLiI+R2lhUGh1R3JvdXAgTHRkLjwvYT4gQWxsIHJpZ2h0cyByZXNlcnZlZC48L3NwYW4+PC9zcGFuPg0KPHNwYW4+RG8gbm90IGhlc2l0YXRlIHRvIGNvbnRhY3QgbWUgaWYgeW91IG5lZWQgbWUgdG8gam9pbiB5b3VyIE1hZ2VudG8gcHJvamVjdC48YnIvPk15IHJhdGUgaXMgJDMwL2hvdXIgaW4gTWFnZW50byAyLjwvc3Bhbj4NCjxzcGFuIGNsYXNzPSJza3lwZSI+PGEgaHJlZj0ic2t5cGU6Y3VvbmducTg3P2NhbGwiPkNhbGwgbWUgb24gU2t5cGU8L2E+PC9zcGFuPg0KPHNwYW4+PGEgaHJlZj0ibWFpbHRvOmJlc3RlYXJubW9uZXk4N0BnbWFpbC5jb20iPlNlbmQgbWUgYW4gZW1haWw8L2E+PC9zcGFuPg==');
3+

view/base/web/css/faq-extension/demo.html

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,46 @@
1313
</head>
1414
<body>
1515
<div class="bgc1 clearfix">
16-
<h1 class="mhmm mvm"><span class="fgc1">Font Name:</span> faq-extension <small class="fgc1">(Glyphs:&nbsp;8)</small></h1>
16+
<h1 class="mhmm mvm"><span class="fgc1">Font Name:</span> faq-extension <small class="fgc1">(Glyphs:&nbsp;9)</small></h1>
1717
</div>
1818
<div class="clearfix mhl ptl">
19-
<h1 class="mvm mtn fgc1">Grid Size: 16</h1>
19+
<h1 class="mvm mtn fgc1">Grid Size: Unknown</h1>
20+
<div class="glyph fs1">
21+
<div class="clearfix bshadow0 pbs">
22+
<span class="faq-iconicon-gpg">
23+
24+
</span>
25+
<span class="mls"> faq-iconicon-gpg</span>
26+
</div>
27+
<fieldset class="fs0 size1of1 clearfix hidden-false">
28+
<input type="text" readonly value="e901" class="unit size1of2" />
29+
<input type="text" maxlength="1" readonly value="&#xe901;" class="unitRight size1of2 talign-right" />
30+
</fieldset>
31+
<div class="fs0 bshadow0 clearfix hidden-true">
32+
<span class="unit pvs fgc1">liga: </span>
33+
<input type="text" readonly value="" class="liga unitRight" />
34+
</div>
35+
</div>
2036
<div class="glyph fs1">
37+
<div class="clearfix bshadow0 pbs">
38+
<span class="faq-iconfaq-icon">
39+
40+
</span>
41+
<span class="mls"> faq-iconfaq-icon</span>
42+
</div>
43+
<fieldset class="fs0 size1of1 clearfix hidden-false">
44+
<input type="text" readonly value="e900" class="unit size1of2" />
45+
<input type="text" maxlength="1" readonly value="&#xe900;" class="unitRight size1of2 talign-right" />
46+
</fieldset>
47+
<div class="fs0 bshadow0 clearfix hidden-true">
48+
<span class="unit pvs fgc1">liga: </span>
49+
<input type="text" readonly value="" class="liga unitRight" />
50+
</div>
51+
</div>
52+
</div>
53+
<div class="clearfix mhl ptl">
54+
<h1 class="mvm mtn fgc1">Grid Size: 16</h1>
55+
<div class="glyph fs2">
2156
<div class="clearfix bshadow0 pbs">
2257
<span class="faq-iconcalendar">
2358

@@ -33,7 +68,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
3368
<input type="text" readonly value="calendar, date" class="liga unitRight" />
3469
</div>
3570
</div>
36-
<div class="glyph fs1">
71+
<div class="glyph fs2">
3772
<div class="clearfix bshadow0 pbs">
3873
<span class="faq-iconuser">
3974

@@ -49,7 +84,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
4984
<input type="text" readonly value="user, profile2" class="liga unitRight" />
5085
</div>
5186
</div>
52-
<div class="glyph fs1">
87+
<div class="glyph fs2">
5388
<div class="clearfix bshadow0 pbs">
5489
<span class="faq-iconeye">
5590

@@ -65,7 +100,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
65100
<input type="text" readonly value="eye, views" class="liga unitRight" />
66101
</div>
67102
</div>
68-
<div class="glyph fs1">
103+
<div class="glyph fs2">
69104
<div class="clearfix bshadow0 pbs">
70105
<span class="faq-iconhappy">
71106

@@ -81,7 +116,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
81116
<input type="text" readonly value="happy, emoticon" class="liga unitRight" />
82117
</div>
83118
</div>
84-
<div class="glyph fs1">
119+
<div class="glyph fs2">
85120
<div class="clearfix bshadow0 pbs">
86121
<span class="faq-iconangry">
87122

@@ -97,7 +132,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
97132
<input type="text" readonly value="angry, emoticon15" class="liga unitRight" />
98133
</div>
99134
</div>
100-
<div class="glyph fs1">
135+
<div class="glyph fs2">
101136
<div class="clearfix bshadow0 pbs">
102137
<span class="faq-iconplus">
103138

@@ -113,7 +148,7 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
113148
<input type="text" readonly value="plus, add" class="liga unitRight" />
114149
</div>
115150
</div>
116-
<div class="glyph fs1">
151+
<div class="glyph fs2">
117152
<div class="clearfix bshadow0 pbs">
118153
<span class="faq-iconminus">
119154

@@ -130,25 +165,6 @@ <h1 class="mvm mtn fgc1">Grid Size: 16</h1>
130165
</div>
131166
</div>
132167
</div>
133-
<div class="clearfix mhl ptl">
134-
<h1 class="mvm mtn fgc1">Grid Size: Unknown</h1>
135-
<div class="glyph fs2">
136-
<div class="clearfix bshadow0 pbs">
137-
<span class="faq-iconfaq-icon">
138-
139-
</span>
140-
<span class="mls"> faq-iconfaq-icon</span>
141-
</div>
142-
<fieldset class="fs0 size1of1 clearfix hidden-false">
143-
<input type="text" readonly value="e900" class="unit size1of2" />
144-
<input type="text" maxlength="1" readonly value="&#xe900;" class="unitRight size1of2 talign-right" />
145-
</fieldset>
146-
<div class="fs0 bshadow0 clearfix hidden-true">
147-
<span class="unit pvs fgc1">liga: </span>
148-
<input type="text" readonly value="" class="liga unitRight" />
149-
</div>
150-
</div>
151-
</div>
152168

153169
<!--[if gt IE 8]><!-->
154170
<div class="mhl clearfix mbl">
Binary file not shown.

0 commit comments

Comments
 (0)