Skip to content

Commit 4e21e98

Browse files
committed
Add cms and static block info
1 parent fbf1d55 commit 4e21e98

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/**
4+
* MagePrince
5+
* Copyright (C) 2020 Mageprince <[email protected]>
6+
*
7+
* @package Mageprince_Faq
8+
* @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/)
9+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0)
10+
* @author MagePrince <[email protected]>
11+
*/
12+
13+
namespace Mageprince\Faq\Block\Adminhtml\System\Config\Field;
14+
15+
class FaqBlockInfo extends \Magento\Config\Block\System\Config\Form\Field
16+
{
17+
/**
18+
* Template path
19+
*
20+
* @var string
21+
*/
22+
protected $_template = 'Mageprince_Faq::system/config/Field/FaqBlockInfo.phtml';
23+
24+
/**
25+
* Render fieldset html
26+
*
27+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
28+
* @return string
29+
*/
30+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
31+
{
32+
return $this->_decorateRowHtml($element, "<td colspan='2'>" . $this->toHtml() . '</td>');
33+
}
34+
}

etc/adminhtml/system.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
7373
</field>
7474
</group>
75+
<group id="faq_info" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
76+
<label>Code for CMS Page and Static block</label>
77+
<field id="faq_block_info" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1">
78+
<frontend_model>Mageprince\Faq\Block\Adminhtml\System\Config\Field\FaqBlockInfo</frontend_model>
79+
</field>
80+
</group>
7581
</section>
7682
</system>
7783
</config>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
// @codingStandardsIgnoreFile
3+
/**
4+
* @see \Mageprince\Faq\Block\Adminhtml\System\Config\Field\FaqBlockInfo
5+
* @var \Mageprince\Faq\Block\Adminhtml\System\Config\Field\FaqBlockInfo $block
6+
*/
7+
8+
?>
9+
<div class="faq-info-block">
10+
<div class="attachment-note"><?= __('Use below code to show FAQ on CMS or Static Blocks') ?></div>
11+
<div class="userguide-container">
12+
<div id="messages">
13+
<ul class="messages">
14+
<li class="message message-notice notice" style="list-style: none;">
15+
<ul>
16+
<li style="list-style: none;">
17+
Use this code to show all FAQ
18+
</li>
19+
</ul>
20+
</li>
21+
</ul>
22+
</div>
23+
<code>
24+
{{block class="Mageprince\Faq\Block\Index\Index" template="Mageprince_Faq::faq_main.phtml" show_group_title=1 show_group=1 page_type="scroll"}}
25+
</code>
26+
</div>
27+
<div class="userguide-container">
28+
<div id="messages">
29+
<ul class="messages">
30+
<li class="message message-notice notice" style="list-style: none;">
31+
<ul>
32+
<li style="list-style: none;">
33+
Use <b>group_id</b> to show FAQ by group
34+
</li>
35+
</ul>
36+
</li>
37+
</ul>
38+
</div>
39+
<code>
40+
{{block class="Mageprince\Faq\Block\Index\Index" template="Mageprince_Faq::faq_main.phtml" group_id=1 show_group_title=1}}
41+
</code>
42+
</div>
43+
<div class="userguide-container">
44+
<div id="messages">
45+
<ul class="messages">
46+
<li class="message message-notice notice" style="list-style: none;">
47+
<ul>
48+
<li style="list-style: none;">
49+
Parameters
50+
</li>
51+
</ul>
52+
</li>
53+
</ul>
54+
</div>
55+
<ul class="faq-parameters">
56+
<li><b>1.show_group_title:</b> Show/Hide group title. Value must be 0 or 1</li>
57+
<li><b>2.show_group:</b> Show/Hide group icon. Value must be 0 or 1</li>
58+
<li><b>3.page_type:</b> Page type to show. Value must be “scroll” or “ajax”</li>
59+
<li><b>4.group_id:</b> You can find group if from FAQ->Manage FAQGroups</li>
60+
</ul>
61+
</div>
62+
</div>
63+
<style type="text/css">
64+
.faq-info-block .userguide-container {
65+
border: dotted 1px #ccc;
66+
padding: 20px;
67+
margin-top: 25px;
68+
}
69+
70+
.faq-info-block .attachment-note {
71+
font-weight: bold;
72+
margin-top: 30px;
73+
text-align: center;
74+
font-size: 16px;
75+
}
76+
ul.faq-parameters {
77+
list-style: none;
78+
}
79+
ul.faq-parameters li {
80+
padding: 5px;
81+
}
82+
</style>
83+

0 commit comments

Comments
 (0)