11 use Magento\Config\Model\Config\StructureFactory;
36 private $configStructureFactory;
43 private $configValueFactory;
57 private $jsonSerializer;
68 StructureFactory $structureFactory,
70 JsonSerializer $jsonSerializer
72 $this->scope = $scope;
73 $this->configStructureFactory = $structureFactory;
74 $this->configValueFactory = $valueFactory;
75 $this->jsonSerializer = $jsonSerializer;
88 public function process($scope, $scopeCode,
$value,
$path)
90 $areaScope = $this->scope->getCurrentScope();
93 $configStructure = $this->configStructureFactory->
create();
94 $this->scope->setCurrentScope($areaScope);
97 $field = $configStructure->getElementByConfigPath(
$path);
100 $backendModel = $field && $field->hasBackendModel()
101 ? $field->getBackendModel()
102 : $this->configValueFactory->create();
104 if ($backendModel instanceof
Encrypted) {
108 $backendModel->setPath(
$path);
109 $backendModel->setScope($scope);
110 $backendModel->setScopeId($scopeCode);
111 $backendModel->setValue(
$value);
112 $backendModel->afterLoad();
113 $processedValue = $backendModel->getValue();
119 return is_array($processedValue) ? $this->jsonSerializer->serialize($processedValue) : $processedValue;
__construct(ScopeInterface $scope, StructureFactory $structureFactory, ValueFactory $valueFactory, JsonSerializer $jsonSerializer)