Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
VideoExtractor.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
15  const MEDIA_TYPE_CODE = 'video';
16 
24  public function process(\DOMElement $mediaNode, $mediaParentTag)
25  {
26  $result = [];
27  $moduleNameVideo = $mediaNode->getAttribute('module');
28  foreach ($mediaNode->getElementsByTagName(self::MEDIA_TYPE_CODE) as $node) {
29  $videoId = $node->getAttribute('id');
30  $result[$mediaParentTag][$moduleNameVideo][Media::MEDIA_TYPE_CONFIG_NODE][$videoId]['type']
31  = $node->getAttribute('type');
32  foreach ($node->childNodes as $attribute) {
33  if ($attribute->nodeType != XML_ELEMENT_NODE) {
34  continue;
35  }
36  $nodeValue = $attribute->nodeValue;
37  $result[$mediaParentTag][$moduleNameVideo][Media::MEDIA_TYPE_CONFIG_NODE][$videoId][$attribute->tagName]
38  = $nodeValue;
39  }
40  }
41  return $result;
42  }
43 }
process(\DOMElement $mediaNode, $mediaParentTag)