Skip to content

Commit 2f58bf9

Browse files
committed
Merge branch 'ACP2E-2069' of https://github.com/magento-l3/magento2ce into Tier4-PR-10-30-2023
2 parents 3bfbf3b + 60d38cd commit 2f58bf9

File tree

1 file changed

+12
-21
lines changed
  • lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider

1 file changed

+12
-21
lines changed

lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/Sanitizer.php

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,19 @@ private function extractConfig(array $data)
4343
public function sanitize(array $data): array
4444
{
4545
$config = $this->extractConfig($data);
46-
$toProcess = [];
47-
array_walk(
48-
$data,
49-
function ($datum, string $key) use (&$config, &$toProcess) : void {
50-
if (is_array($datum)) {
51-
//Each array must have it's own __disableTmpl property
52-
$toProcess[$key] = $datum;
53-
} elseif ((
54-
!is_bool($config) && !array_key_exists($key, $config)
55-
)
56-
&& (is_string($datum) || $datum instanceof Phrase)
57-
&& preg_match('/\$\{.+\}/', (string)$datum)
58-
) {
59-
//Templating is not disabled for all properties or for this property specifically
60-
//Property is a string that contains template syntax so we are disabling it's rendering
61-
$config[$key] = true;
62-
}
46+
foreach ($data as $key => $datum) {
47+
if (is_array($datum)) {
48+
//Each array must have its own __disableTmpl property
49+
$data[$key] = $this->sanitize($datum);
50+
} elseif (!is_bool($config)
51+
&& !array_key_exists($key, $config)
52+
&& (is_string($datum) || $datum instanceof Phrase)
53+
&& preg_match('/\$\{.+\}/', (string)$datum)
54+
) {
55+
//Templating is not disabled for all properties or for this property specifically
56+
//Property is a string that contains template syntax, so we are disabling its rendering
57+
$config[$key] = true;
6358
}
64-
);
65-
if ($toProcess) {
66-
//Processing sub-arrays
67-
$data = array_replace($data, array_map([$this, 'sanitize'], $toProcess));
6859
}
6960
if ($config !== []) {
7061
//Some properties require rendering configuration.

0 commit comments

Comments
 (0)