/** * Set correct scope if isSingleStoreMode = true * * @param \Magento\Config\Model\Config\Structure\Element\Field $fieldConfig * @param \Magento\Framework\App\Config\ValueInterface $dataObject * @return void */ protected function _checkSingleStoreMode(\Magento\Config\Model\Config\Structure\Element\Field $fieldConfig, $dataObject) { $isSingleStoreMode = $this->_storeManager->isSingleStoreMode(); if (!$isSingleStoreMode) { return; } if (!$fieldConfig->showInDefault()) { $websites = $this->_storeManager->getWebsites(); $singleStoreWebsite = array_shift($websites); $dataObject->setScope('websites'); $dataObject->setWebsiteCode($singleStoreWebsite->getCode()); $dataObject->setScopeCode($singleStoreWebsite->getCode()); $dataObject->setScopeId($singleStoreWebsite->getId()); } }
public function testShowInDefault() { $this->assertFalse($this->_model->showInDefault()); $this->_model->setData(['showInDefault' => 1], 'scope'); $this->assertTrue($this->_model->showInDefault()); }
/** * {@inheritdoc} */ public function showInDefault() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'showInDefault'); if (!$pluginInfo) { return parent::showInDefault(); } else { return $this->___callPlugins('showInDefault', func_get_args(), $pluginInfo); } }