Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply current filter label to state with escaping. #1271

Merged
merged 1 commit into from
Jan 17, 2019
Merged
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 @@ -35,6 +35,11 @@ class Attribute extends \Magento\CatalogSearch\Model\Layer\Filter\Attribute impl
*/
private $tagFilter;

/**
* @var \Magento\Framework\Escaper
*/
private $escaper;

/**
* @var boolean
*/
Expand All @@ -53,6 +58,7 @@ class Attribute extends \Magento\CatalogSearch\Model\Layer\Filter\Attribute impl
* @param \Magento\Catalog\Model\Layer $layer Catalog product layer.
* @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder Item data builder.
* @param \Magento\Framework\Filter\StripTags $tagFilter String HTML tags filter.
* @param \Magento\Framework\Escaper $escaper Html Escaper.
* @param \Smile\ElasticsuiteCatalog\Helper\ProductAttribute $mappingHelper Mapping helper.
* @param array $data Custom data.
*/
Expand All @@ -62,6 +68,7 @@ public function __construct(
\Magento\Catalog\Model\Layer $layer,
\Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder,
\Magento\Framework\Filter\StripTags $tagFilter,
\Magento\Framework\Escaper $escaper,
\Smile\ElasticsuiteCatalog\Helper\ProductAttribute $mappingHelper,
array $data = []
) {
Expand All @@ -75,6 +82,7 @@ public function __construct(
);

$this->tagFilter = $tagFilter;
$this->escaper = $escaper;
$this->mappingHelper = $mappingHelper;
}

Expand All @@ -99,7 +107,7 @@ public function apply(\Magento\Framework\App\RequestInterface $request)
$layerState = $this->getLayer()->getState();

foreach ($this->currentFilterValue as $currentFilter) {
$filter = $this->_createItem($currentFilter, $this->currentFilterValue);
$filter = $this->_createItem($this->escaper->escapeHtml($currentFilter), $this->currentFilterValue);
$layerState->addFilter($filter);
}
}
Expand Down