STEP-3 Backend Configurations Settings
In this step we going to create Module backend configurations
STEP-3
For our implementation, we need several backend configurations
  • Enabled
  • Button Type (Rounded, Square)
  • Button Size
  • Display on Yes/No
    • Homepage
    • Category Page
    • Product Page
  • Facebook
    • Enable
    • Enable Counter
  • Facebook Messenger
    • Enable
    • Messenger app ID
  • Telegram
    • Enable
  • Whatsapp
    • Enable
  • LinkedIn
    • Enable
  • Email
    • Enable
    • Subject Suffix
Let’s create them.
  1. 1.
    Create adminhtml folder in <MODULE ROOT>/etc and system folder in it
  2. 2.
    create system.xml in <MODULE ROOT>/etc/adminhtml
ScandiPWA/SocialShareGraphQl/etc/adminhtml/system.xml
1
<?xml version="1.0"?>
2
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
3
<system>
4
<tab id="scandipwa" translate="label" sortOrder="100">
5
<label>Scandipwa</label>
6
</tab>
7
<include path="ScandiPWA_SocialShareGraphQl::system/social_share.xml"/>
8
</system>
9
</config>
Copied!
3. Create social_share.xml in <MODULE ROOT>/etc/adminhtml/system
ScandiPWA/SocialShareGraphQl/etc/adminhtml/system/social_share.xml
1
<?xml version="1.0"?>
2
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
3
<section id="socialshare" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="0" showInStore="0">
4
<label>Social Share</label>
5
<tab>scandipwa</tab>
6
<resource>ScandiPWA_SocialShareGraphQl::social_share</resource>
7
<!-- General-->
8
<group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
9
<label>General Settings</label>
10
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
11
<label>Enable</label>
12
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
13
</field>
14
15
<field id="rounded" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
16
<label>Rounded Icons</label>
17
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
18
</field>
19
20
<field id="size" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
21
<label>Icon Size</label>
22
<comment>in pixel's</comment>
23
</field>
24
25
<field id="home_page" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0">
26
<label>Display On HomePage</label>
27
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
28
</field>
29
30
<field id="category_page" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0">
31
<label>Display On Product Page</label>
32
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
33
</field>
34
35
<field id="product_page" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0">
36
<label>Display On Category Page</label>
37
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
38
</field>
39
</group>
40
<!-- FaceBook-->
41
<group id="facebook" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
42
<label>Facebook</label>
43
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
44
<label>Enable Facebook</label>
45
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
46
</field>
47
48
<field id="enable_counter" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
49
<label>Enable Facebook Counter</label>
50
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
51
</field>
52
</group>
53
<!-- Facebook Messenger-->
54
<group id="facebook_messenger" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
55
<label>Facebook Messenger</label>
56
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
57
<label>Enable Facebook Messenger</label>
58
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
59
</field>
60
61
<field id="app_id" translate="text" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
62
<label>Facebook Messenger App ID</label>
63
</field>
64
</group>
65
<!-- Telegram-->
66
<group id="telegram" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
67
<label>Telegram</label>
68
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
69
<label>Enable Telegram</label>
70
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
71
</field>
72
</group>
73
<!-- WhatsApp-->
74
<group id="whatsapp" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
75
<label>WhatsApp</label>
76
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
77
<label>Enable WhatsApp</label>
78
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
79
</field>
80
</group>
81
<!-- LinkedIn-->
82
<group id="linkedin" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
83
<label>LinkedIn</label>
84
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
85
<label>Enable LinkedIn</label>
86
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
87
</field>
88
</group>
89
<!-- Email-->
90
<group id="email" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
91
<label>Email</label>
92
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
93
<label>Enable Email</label>
94
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
95
</field>
96
<field id="suffix" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
97
<label>Email Subject Suffix</label>
98
</field>
99
</group>
100
</section>
101
</include>
Copied!
4. Create config.xml in <MODULE ROOT>/etc/
ScandiPWA/SocialShareGraphQl/etc/config.xml
1
<?xml version="1.0"?>
2
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
3
<default>
4
<socialshare>
5
<general>
6
<enable>0</enable>
7
<rounded>1</rounded>
8
<size>35</size>
9
<home_page>0</home_page>
10
<category_page>0</category_page>
11
<product_page>1</product_page>
12
</general>
13
<facebook>
14
<enable>0</enable>
15
<enable_counter>0</enable_counter>
16
</facebook>
17
<facebook_messenger>
18
<enable>0</enable>
19
</facebook_messenger>
20
<telegram>
21
<enable>0</enable>
22
</telegram>
23
<whatsapp>
24
<enable>0</enable>
25
</whatsapp>
26
<linkedin>
27
<enable>0</enable>
28
</linkedin>
29
<email>
30
<enable>0</enable>
31
<suffix>ScandiPWA</suffix>
32
</email>
33
</socialshare>
34
</default>
35
</config>
36
Copied!
5. run cache:flush
6. Navigate to Magento backend dashboard STORE -> Settings -> Configuration, expand SCANDIPWA you should see Social Share Option
Could not load image
Copy link