Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Data Class Reference
Inheritance diagram for Data:
DataInterface

Public Member Functions

 __construct ( $componentName, ReaderFactory $readerFactory, CacheInterface $cache, SerializerInterface $serializer, InterpreterInterface $argumentInterpreter)
 
 merge (array $config)
 
 get ($path=null, $default=null)
 

Data Fields

const CACHE_ID = 'ui_component_configuration_data'
 
const SEARCH_PATTERN = '%s.xml'
 

Detailed Description

UI Component configuration data

Definition at line 16 of file Data.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $componentName,
ReaderFactory  $readerFactory,
CacheInterface  $cache,
SerializerInterface  $serializer,
InterpreterInterface  $argumentInterpreter 
)
Parameters
string$componentName
ReaderFactory$readerFactory
CacheInterface$cache
SerializerInterface$serializer
InterpreterInterface$argumentInterpreter

Definition at line 74 of file Data.php.

80  {
81  $this->readerFactory = $readerFactory;
82  $this->cache = $cache;
83  $this->serializer = $serializer;
84  $this->componentName = $componentName;
85  $this->argumentInterpreter = $argumentInterpreter;
86  $this->cacheId = static::CACHE_ID . '_' . $componentName;
87  }

Member Function Documentation

◆ get()

get (   $path = null,
  $default = null 
)

Get config value by key

Parameters
string$path
mixed$default
Returns
mixed

Implements DataInterface.

Definition at line 133 of file Data.php.

134  {
135  if (empty($this->data)) {
136  $this->initData();
137  }
138  if ($path === null) {
139  return $this->data;
140  }
141  $keys = explode('/', $path);
142  $data = $this->data;
143  foreach ($keys as $key) {
144  if (is_array($data) && array_key_exists($key, $data)) {
145  $data = $data[$key];
146  } else {
147  return $default;
148  }
149  }
150  return $data;
151  }

◆ merge()

merge ( array  $config)

Merge config data to the object

Parameters
array$config
Returns
void

Implements DataInterface.

Definition at line 121 of file Data.php.

122  {
123  $this->data = array_replace_recursive($this->get(), $config);
124  }
$config
Definition: fraud_order.php:17

Field Documentation

◆ CACHE_ID

const CACHE_ID = 'ui_component_configuration_data'

ID in the storage cache

Definition at line 21 of file Data.php.

◆ SEARCH_PATTERN

const SEARCH_PATTERN = '%s.xml'

Search pattern

Definition at line 26 of file Data.php.


The documentation for this class was generated from the following file: