_design = $design; parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } /** * Validate specified value against frontend area * * @return $this */ public function beforeSave() { if ('' != $this->getValue()) { $design = clone $this->_design; $design->setDesignTheme($this->getValue(), \Magento\Framework\App\Area::AREA_FRONTEND); } return parent::beforeSave(); } /** * Invalidate cache * * @param bool $forceInvalidate * @return void */ protected function invalidateCache($forceInvalidate = false) { $types = array_keys( $this->_config->getValue( self::XML_PATH_INVALID_CACHES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); if ($forceInvalidate || $this->isValueChanged()) { $this->cacheTypeList->invalidate($types); } } /** * @return array */ public function getValue() { return $this->getData('value') !== null ? $this->getData('value') : ''; } /** * {@inheritdoc} * * {@inheritdoc}. In addition, it sets status 'invalidate' for blocks and other output caches * * @return $this */ public function afterSave() { $this->invalidateCache(); return parent::afterSave(); } /** * {@inheritdoc} */ public function afterDelete() { $this->invalidateCache(true); return parent::afterDelete(); } }