13 class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter
45 \
Magento\Catalog\Model\
Layer\Filter\ItemFactory $filterItemFactory,
54 $this->_resource = $filterAttributeFactory->create();
56 $this->_requestVar =
'attribute';
79 $filter =
$request->getParam($this->_requestVar);
80 if (is_array($filter)) {
84 if ($filter && strlen(
$text)) {
85 $this->
_getResource()->applyFilterToCollection($this, $filter);
101 $this->_requestVar =
$attribute->getAttributeCode();
106 if (is_array(
$option[
'value'])) {
109 if ($this->string->strlen(
$option[
'value'])) {
112 if (!empty($optionsCount[
$option[
'value']])) {
113 $this->itemDataBuilder->addItemData(
114 $this->tagFilter->filter(
$option[
'label']),
116 $optionsCount[
$option[
'value']]
120 $this->itemDataBuilder->addItemData(
121 $this->tagFilter->filter(
$option[
'label']),
123 isset($optionsCount[
$option[
'value']]) ? $optionsCount[
$option[
'value']] : 0
129 return $this->itemDataBuilder->build();
_createItem($label, $value, $count=0)
const ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
getAttributeIsFilterable($attribute)
__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\Catalog\Model\ResourceModel\Layer\Filter\AttributeFactory $filterAttributeFactory, \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Filter\StripTags $tagFilter, array $data=[])
apply(\Magento\Framework\App\RequestInterface $request)