private function getFilterArray(array $request, \Magento\Catalog\Model\Product $product)
    {
        $filterArray = [];
        $attributes = $this->eavConfig->getEntityAttributes(\Magento\Catalog\Model\Product::ENTITY, $product);

        foreach ($request as $code => $value) {
            if (array_key_exists($code, $attributes)) {
                $attribute = $attributes[$code];
                if ($this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code] = $value;
                }

                if (isset($filterArray[$code]) && !is_array($filterArray[$code])) {
                    $filterArray[$code] = [$filterArray[$code]];
                }

                if ($attribute->getId() && $this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code][] = $this->swatchHelperData->getOptionIds($attribute, $value);
                }
            }
        }

        return $filterArray;
    }
private function getFilterArray(array $request, \Magento\Catalog\Model\Product $product)
    {
        $filterArray = [];
        $attributes = $this->eavConfig->getEntityAttributes(\Magento\Catalog\Model\Product::ENTITY, $product);

        foreach ($request as $code => $value) {
            if (array_key_exists($code, $attributes)) {
                $attribute = $attributes[$code];
                if ($this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code] = $value;
                }

                if (isset($filterArray[$code]) && !is_array($filterArray[$code])) {
                    $filterArray[$code] = [$filterArray[$code]];
                }

                if ($attribute->getId() && $this->canReplaceImageWithSwatch($attribute)) {
                    $filterArray[$code][] = $this->swatchHelperData->getOptionIds($attribute, $value);
                }
            }
        }

        return $filterArray;
    }
private function getFilterArray ( array $ request , \ Magento \ Catalog \ Model \ Product $ product ) { $ filterArray = [ ] ; $ attributes = $ this -> eavConfig -> getEntityAttributes ( \ Magento \ Catalog \ Model \ Product :: ENTITY , $ product ) ; foreach ( $ request as $ code => $ value ) { if ( array_key_exists ( $ code , $ attributes ) ) { $ attribute = $ attributes [ $ code ] ; if ( $ this -> canReplaceImageWithSwatch ( $ attribute ) ) { $ filterArray [ $ code ] = $ value ; } if ( isset ( $ filterArray [ $ code ] ) && ! is_array ( $ filterArray [ $ code ] ) ) { $ filterArray [ $ code ] = [ $ filterArray [ $ code ] ] ; } if ( $ attribute -> getId ( ) && $ this -> canReplaceImageWithSwatch ( $ attribute ) ) { $ filterArray [ $ code ] [ ] = $ this -> swatchHelperData -> getOptionIds ( $ attribute , $ value ) ; } } } return $ filterArray ; }
Get filters from request and replace labels by option ids.

@param array                          $request Request parameters.
@param \Magento\Catalog\Model\Product $product Product.

@return array
Get filters from request and replace labels by option ids .