Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConverterType.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  private $converter;
20 
24  public function __construct(ConverterInterface $converter)
25  {
26  $this->converter = $converter;
27  }
28 
33  public function parse(array $data, \DOMNode $node)
34  {
35  $result = [];
36  $domXPath = new \DOMXPath($node->ownerDocument);
37  $nodeList = $domXPath->query(trim($data['value']), $node);
38  foreach ($nodeList as $itemNode) {
39  $result = $this->converter->convert($itemNode, $data);
40  }
41 
42  if ($result && isset($data['name'])) {
43  $result = array_merge($result, ['name' => $data['name']]);
44  }
45 
46  return $result;
47  }
48 }
__construct(ConverterInterface $converter)