Skip to content

Commit 0a668f6

Browse files
committed
MC-3582: Build stabilization for MC-1405
- Fixed block metadata
1 parent 4704829 commit 0a668f6

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

app/code/Magento/PageBuilder/Model/Stage/Renderer/CmsStaticBlock.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function render(array $params): array
8888

8989
if ($block->isActive()) {
9090
$directiveResult = $this->widgetDirectiveRenderer->render($params);
91-
$result = $this->removeScriptTags($directiveResult);
91+
$result['content'] = $this->removeScriptTags($directiveResult['content']);
9292
} else {
9393
$result['error'] = __('Block disabled');
9494
}
@@ -99,26 +99,23 @@ public function render(array $params): array
9999
/**
100100
* Remove script tag from html
101101
*
102-
* @param array $directiveResult
103-
* @return array
102+
* @param string $content
103+
* @return string
104104
*/
105-
private function removeScriptTags(array $directiveResult): array
105+
private function removeScriptTags(string $content): string
106106
{
107107
$dom = new \DOMDocument();
108108
try {
109109
//this code is required because of https://bugs.php.net/bug.php?id=60021
110110
$previous = libxml_use_internal_errors(true);
111-
$dom->loadHTML($directiveResult['content']);
111+
$dom->loadHTML($content);
112112
} catch (\Exception $e) {
113113
$this->loggerInterface->critical($e->getMessage());
114114
}
115115
libxml_use_internal_errors($previous);
116116
foreach (iterator_to_array($dom->getElementsByTagName('script')) as $item) {
117117
$item->parentNode->removeChild($item);
118118
}
119-
return [
120-
'content' => $dom->saveHTML(),
121-
'error' => $directiveResult['error']
122-
];
119+
return $dom->saveHTML();
123120
}
124121
}

0 commit comments

Comments
 (0)