We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 98e95015 authored by Chính's avatar Chính

Create setting enable for wishlist, sticker and sidebar

parent 81b91d06
<?php
namespace Plugilo\Plugilo\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;
class Data extends AbstractHelper
{
public const XML_PATH_ENABLE = 'plugilo/management';
public const PLUGILO_PATH_WISHLIST = 'wishlist';
public const PLUGILO_PATH_SIDEBAR = 'sidebar';
public const PLUGILO_PATH_STICKER = 'sticker';
private function isEnabled($plugiloPart, $storeId = null): bool
{
$enabled = $this->scopeConfig->getValue(
self::XML_PATH_ENABLE . $plugiloPart,
ScopeInterface::SCOPE_STORE,
$storeId
);
return !$enabled ? false : true;
}
public function isEnabledWishlist($storeId = null): bool
{
return $this->isEnabled(self::PLUGILO_PATH_WISHLIST, $storeId);
}
public function isEnabledSidebar($storeId = null): bool
{
return $this->isEnabled(self::PLUGILO_PATH_SIDEBAR, $storeId);
}
public function isEnabledSticker($storeId = null): bool
{
return $this->isEnabled(self::PLUGILO_PATH_STICKER, $storeId);
}
}
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="plugilo" frontName="plugilo">
<module name="Plugilo_Plugilo"/>
</route>
</router>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="plugilo" translate="label" sortOrder="10">
<label>Plugilo</label>
</tab>
<section id="management" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Management</label>
<tab>plugilo</tab>
<resource>Plugilo_Plugilo::management</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>General Configuration</label>
<field id="wishlist" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enable Wishlist</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="sidebar" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enable Sidebar</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="sticker" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enable Sticker</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
</section>
</system>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<plugilo>
<general>
<wishlist>0</wishlist>
<sidebar>0</sidebar>
<sticker>0</sticker>
</general>
</plugilo>
</default>
</config>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment