Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SectionDom.php
Go to the documentation of this file.
1 <?php
8 
15 
21 {
22  const SECTION_META_FILENAME_ATTRIBUTE = "filename";
24 
29  private $validationUtil;
30 
41  public function __construct(
42  $xml,
43  $filename,
44  $exceptionCollector,
45  array $idAttributes = [],
46  $typeAttributeName = null,
47  $schemaFile = null,
48  $errorFormat = self::ERROR_FORMAT_DEFAULT
49  ) {
50  $this->validationUtil = new DuplicateNodeValidationUtil('name', $exceptionCollector);
51  parent::__construct(
52  $xml,
53  $filename,
54  $exceptionCollector,
55  $idAttributes,
59  );
60  }
61 
69  public function initDom($xml, $filename = null)
70  {
71  $dom = parent::initDom($xml, $filename);
72  $sectionNodes = $dom->getElementsByTagName('section');
73  foreach ($sectionNodes as $sectionNode) {
74  $sectionNode->setAttribute(self::SECTION_META_FILENAME_ATTRIBUTE, $filename);
75  $this->validationUtil->validateChildUniqueness(
76  $sectionNode,
77  $filename,
78  $sectionNode->getAttribute(self::SECTION_META_NAME_ATTRIBUTE)
79  );
80  }
81  return $dom;
82  }
83 }
__construct( $xml, $filename, $exceptionCollector, array $idAttributes=[], $typeAttributeName=null, $schemaFile=null, $errorFormat=self::ERROR_FORMAT_DEFAULT)
Definition: SectionDom.php:41