Skip to content

Commit 5c8ed12

Browse files
authored
ENGCOM-6164: Magento 2.3.2 - PWA - graphQl fetching Issue for phtml file called in static block #960 #971
2 parents 68d2137 + 59c4565 commit 5c8ed12

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getData(string $blockIdentifier): array
5656
);
5757
}
5858

59-
$renderedContent = $this->widgetFilter->filter($block->getContent());
59+
$renderedContent = $this->widgetFilter->filterDirective($block->getContent());
6060

6161
$blockData = [
6262
BlockInterface::BLOCK_ID => $block->getId(),

app/code/Magento/Widget/Model/Template/FilterEmulate.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,44 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Widget\Model\Template;
79

10+
/**
11+
* Class FilterEmulate
12+
*
13+
* @package Magento\Widget\Model\Template
14+
*/
815
class FilterEmulate extends Filter
916
{
1017
/**
1118
* Generate widget with emulation frontend area
1219
*
1320
* @param string[] $construction
14-
* @return string
21+
*
22+
* @return mixed|string
23+
* @throws \Exception
1524
*/
1625
public function widgetDirective($construction)
1726
{
1827
return $this->_appState->emulateAreaCode('frontend', [$this, 'generateWidget'], [$construction]);
1928
}
29+
30+
/**
31+
* Filter the string as template with frontend area emulation
32+
*
33+
* @param string $value
34+
*
35+
* @return string
36+
* @throws \Exception
37+
*/
38+
public function filterDirective($value) : string
39+
{
40+
return $this->_appState->emulateAreaCode(
41+
\Magento\Framework\App\Area::AREA_FRONTEND,
42+
[$this, 'filter'],
43+
[$value]
44+
);
45+
}
2046
}

0 commit comments

Comments
 (0)