13 use Magento\Ui\Config\Reader\DefinitionFactory;
23 const CACHE_ID =
'ui_component_configuration_definition_data';
40 private $readerFactory;
62 private $argumentInterpreter;
71 DefinitionFactory $readerFactory,
76 $this->readerFactory = $readerFactory;
79 $this->argumentInterpreter = $argumentInterpreter;
80 $this->cacheId = static::CACHE_ID;
89 private function initData()
91 $data = $this->cache->load($this->cacheId);
92 if (
false === $data) {
94 $reader = $this->readerFactory->create();
95 $data = $reader->read();
96 $this->cache->save($this->serializer->serialize($data), $this->cacheId);
98 $data = $this->serializer->unserialize($data);
102 $this->data = $this->evaluateComponentArguments($data);
114 $this->data = array_replace_recursive($this->data,
$config);
124 public function get($key, $default =
null)
126 return isset($this->data[$key]) ? $this->data[$key] : $default;
135 private function evaluateComponentArguments($components)
137 foreach ($components as &$component) {
147 $this->argumentInterpreter->evaluate($argument);
const DATA_ATTRIBUTES_KEY
__construct(DefinitionFactory $readerFactory, CacheInterface $cache, SerializerInterface $serializer, InterpreterInterface $argumentInterpreter)