In my site having two stores.I want to show store views select option in custom module in adminhtml.How to add functionality for that


You can add field with this code

<field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enabeld </label>

for get the value

const TEST_TEST_ENABLED  = 'test/test/enabled';
protected $_scopeConfig;

public function __construct(
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {

    $this->_scopeConfig = $scopeConfig;
public function getEnabled()
    return $this->_scopeConfig->getValue(
  • Whenever i select default config to other store view the module disable,for appear how to add in system.xml – User0434 Dec 14 '16 at 13:01
  • @Nadh you want to add module disabled in system configuration? – Fme Extensions Dec 14 '16 at 13:04
  • 1
    i want to select option for particular store – User0434 Dec 14 '16 at 13:06
  • you have to change store view of in configuration and values will be store for current store view you don't to add store view with that. you can get values \Magento\Store\Model\ScopeInterface::SCOPE_STORE for current scope. – Fme Extensions Dec 14 '16 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.