Skip to content

Commit

Permalink
ENGCOM-6164: Magento 2.3.2 - PWA - graphQl fetching Issue for phtml f…
Browse files Browse the repository at this point in the history
…ile called in static block #960 #971
  • Loading branch information
lenaorobei authored Oct 28, 2019
2 parents 68d2137 + 59c4565 commit 5c8ed12
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getData(string $blockIdentifier): array
);
}

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

$blockData = [
BlockInterface::BLOCK_ID => $block->getId(),
Expand Down
28 changes: 27 additions & 1 deletion app/code/Magento/Widget/Model/Template/FilterEmulate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,44 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Widget\Model\Template;

/**
* Class FilterEmulate
*
* @package Magento\Widget\Model\Template
*/
class FilterEmulate extends Filter
{
/**
* Generate widget with emulation frontend area
*
* @param string[] $construction
* @return string
*
* @return mixed|string
* @throws \Exception
*/
public function widgetDirective($construction)
{
return $this->_appState->emulateAreaCode('frontend', [$this, 'generateWidget'], [$construction]);
}

/**
* Filter the string as template with frontend area emulation
*
* @param string $value
*
* @return string
* @throws \Exception
*/
public function filterDirective($value) : string
{
return $this->_appState->emulateAreaCode(
\Magento\Framework\App\Area::AREA_FRONTEND,
[$this, 'filter'],
[$value]
);
}
}

0 comments on commit 5c8ed12

Please sign in to comment.