storeManager = $storeManager; } /** * Init current store. * * @return mixed * @throws \Magento\Framework\Exception\NoSuchEntityException */ protected function initCurrentStore(): int { $storeId = (int) $this->getRequest()->getParam('store', 0); $store = $this->storeManager->getStore($storeId); $this->storeManager->setCurrentStore($store->getCode()); return $storeId; } /** * Check "Use Default Value" checkboxes values * * @param array $postData * @param \Magento\Framework\Model\AbstractExtensibleModel $model * @return $this */ protected function prepareUseDefault(array $postData, AbstractExtensibleModel $model) { if (isset($postData['use_default']) && ! empty($postData['use_default'])) { foreach ($postData['use_default'] as $attributeCode => $attributeValue) { if ($attributeValue) { $model->setData($attributeCode, null); } } } return $this; } }