configValidator = $configValidator; parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } /** * Validate a domain name value * * @return void * @throws \Magento\Framework\Exception\LocalizedException */ public function beforeSave() { $value = $this->getValue(); if (!empty($value) && !$this->configValidator->isValid($value)) { throw new \Magento\Framework\Exception\LocalizedException(__('Invalid cookie path')); } } }