Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Magento 2.3.2 - PWA - graphQl fetching Issue for phtml file called in static block #960 #971

Merged
merged 5 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
);
}
}