29 \
Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory,
31 \
Magento\Catalog\Model\Layer $layer,
33 \
Magento\Framework\Filter\StripTags $tagFilter,
43 $this->tagFilter = $tagFilter;
55 $attributeValue =
$request->getParam($this->_requestVar);
56 if (empty($attributeValue) && !is_numeric($attributeValue)) {
62 ->getProductCollection();
84 ->getProductCollection();
87 $isAttributeFilterable =
90 if (count($optionsFacetedData) === 0 && !$isAttributeFilterable) {
91 return $this->itemDataBuilder->build();
99 $this->buildOptionData(
$option, $isAttributeFilterable, $optionsFacetedData, $productSize);
102 return $this->itemDataBuilder->build();
114 private function buildOptionData(
$option, $isAttributeFilterable, $optionsFacetedData, $productSize)
120 $count = $this->getOptionCount(
$value, $optionsFacetedData);
125 $this->itemDataBuilder->addItemData(
126 $this->tagFilter->filter(
$option[
'label']),
138 private function getOptionValue(
$option)
153 private function getOptionCount(
$value, $optionsFacetedData)
155 return isset($optionsFacetedData[
$value][
'count'])
156 ? (int)$optionsFacetedData[
$value][
'count']
__construct(\Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Framework\Filter\StripTags $tagFilter, array $data=[])
apply(\Magento\Framework\App\RequestInterface $request)
_createItem($label, $value, $count=0)
getAttributeIsFilterable($attribute)
isOptionReducesResults($optionCount, $totalSize)