Skip to content

Commit 62c7f98

Browse files
authored
Merge pull request #294 from magento-gl/Hammer_PlatForm_Health_247Beta3_30Jan23
Hammer platform health 247-beta3
2 parents d5b4db8 + 9d2ff6a commit 62c7f98

File tree

8 files changed

+63
-18
lines changed

8 files changed

+63
-18
lines changed

app/code/Magento/PageBuilder/Model/Dom/Document.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\PageBuilder\Model\Dom;
99

1010
use DOMNode;
11-
use Gt\Dom\Document as GtDomDocument;
11+
use Magento\PageBuilder\Model\Dom\DomDocument;
1212
use Magento\Framework\ObjectManagerInterface;
1313
use Magento\PageBuilder\Model\Dom\Adapter\DocumentFragmentInterface;
1414
use Magento\PageBuilder\Model\Dom\Adapter\DocumentInterface;
@@ -26,21 +26,29 @@ class Document implements DocumentInterface
2626
protected $objectManager;
2727

2828
/**
29-
* @var GtDomDocument
29+
* @var DOMDocument
3030
*/
3131
protected $document;
3232

3333
/**
3434
* Document constructor.
3535
* @param ObjectManagerInterface $objectManager
36-
* @param string $document
36+
* @param string $characterSet
37+
* @param string $contentType
3738
*/
3839
public function __construct(
3940
ObjectManagerInterface $objectManager,
40-
string $document = ""
41+
string $characterSet,
42+
string $contentType
4143
) {
4244
$this->objectManager = $objectManager;
43-
$this->document = $this->objectManager->create(GtDomDocument::class, [ 'document' => $document ]);
45+
$this->document = $this->objectManager->create(
46+
DomDocument::class,
47+
[
48+
'characterSet' => $characterSet,
49+
'contentType' => $contentType
50+
]
51+
);
4452
}
4553

4654
/**
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\PageBuilder\Model\Dom;
9+
10+
use Gt\Dom\Document as GtDomDocument;
11+
12+
/**
13+
* PhpGt DOM Document wrapper.
14+
*/
15+
class DomDocument extends GtDomDocument
16+
{
17+
}

app/code/Magento/PageBuilder/Model/Dom/HtmlCollection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use ArrayAccess;
1111
use Countable;
12-
use Gt\Dom\HTMLCollection as GtDomHTMLCollection;
12+
use Gt\Dom\NodeList as GtDomNodeList;
1313
use Iterator;
1414
use Magento\Framework\ObjectManagerInterface;
1515
use Magento\PageBuilder\Model\Dom\Adapter\ElementInterface;
@@ -26,19 +26,19 @@ class HtmlCollection implements Iterator, ArrayAccess, Countable, HtmlCollection
2626
private $objectManager;
2727

2828
/**
29-
* @var GtDomHTMLCollection
29+
* @var GtDomNodeList
3030
*/
3131
private $collection;
3232

3333
/**
3434
* HtmlCollection constructor.
3535
*
3636
* @param ObjectManagerInterface $objectManager
37-
* @param GtDomHTMLCollection $collection
37+
* @param GtDomNodeList $collection
3838
*/
3939
public function __construct(
4040
ObjectManagerInterface $objectManager,
41-
GtDomHTMLCollection $collection
41+
GtDomNodeList $collection
4242
) {
4343
$this->objectManager = $objectManager;
4444
$this->collection = $collection;

app/code/Magento/PageBuilder/Model/Dom/HtmlDocument.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@ class HtmlDocument extends Document implements HtmlDocumentInterface
2121
* HtmlDocument constructor.
2222
* @param ObjectManagerInterface $objectManager
2323
* @param string $document
24+
* @param string $characterSet
25+
* @param string $contentType
2426
*/
2527
public function __construct(
2628
ObjectManagerInterface $objectManager,
27-
string $document = ""
29+
string $document,
30+
string $characterSet = "UTF-8",
31+
string $contentType = "text/html"
2832
) {
29-
parent::__construct($objectManager, $document);
30-
$this->document = $this->objectManager->create(GtDomHTMLDocument::class, [ 'document' => $document ]);
33+
parent::__construct($objectManager, $characterSet, $contentType);
34+
$this->document = $this->objectManager->create(
35+
GtDomHTMLDocument::class,
36+
[
37+
"html" => $document,
38+
"characterSet" => $characterSet
39+
]
40+
);
3141
}
3242

3343
/**

app/code/Magento/PageBuilder/Model/Dom/StringMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\PageBuilder\Model\Dom;
99

10-
use Gt\Dom\StringMap as GtDomStringMap;
10+
use Gt\Dom\DOMStringMap as GtDomStringMap;
1111
use Magento\Framework\ObjectManagerInterface;
1212
use Magento\PageBuilder\Model\Dom\Adapter\StringMapInterface;
1313

app/code/Magento/PageBuilder/Model/Dom/TokenList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\PageBuilder\Model\Dom;
99

10-
use Gt\Dom\TokenList as GtDomTokenList;
10+
use Gt\Dom\DOMTokenList as GtDomTokenList;
1111
use Magento\Framework\ObjectManagerInterface;
1212
use Magento\PageBuilder\Model\Dom\Adapter\TokenListInterface;
1313

app/code/Magento/PageBuilder/Model/Dom/XmlDocument.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ class XmlDocument extends Document implements XmlDocumentInterface
2121
*
2222
* @param ObjectManagerInterface $objectManager
2323
* @param string $document
24+
* @param string $characterSet
25+
* @param string $contentType
2426
*/
2527
public function __construct(
2628
ObjectManagerInterface $objectManager,
27-
string $document = ""
29+
string $document = "",
30+
string $characterSet = "UTF-8",
31+
string $contentType = "text/html"
2832
) {
29-
parent::__construct($objectManager, $document);
30-
$this->document = $this->objectManager->create(GtDomXmlDocument::class, [ 'document' => $document ]);
33+
parent::__construct($objectManager, $characterSet, $contentType);
34+
$this->document = $this->objectManager->create(
35+
GtDomXmlDocument::class,
36+
[
37+
"document" => $document,
38+
"characterSet" => $characterSet
39+
]
40+
);
3141
}
3242
}

app/code/Magento/PageBuilder/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"magento/module-require-js": "*",
2323
"magento/module-media-storage": "*",
2424
"php": "~8.1.0||~8.2.0||~8.3.0",
25-
"phpgt/dom": "^2.2"
25+
"phpgt/dom": "^4.1"
2626
},
2727
"suggest": {
2828
"magento/module-review": "*"

0 commit comments

Comments
 (0)