Skip to content

Commit

Permalink
Merge pull request #1060 from romainruaud/fix_swatch-attribute-type
Browse files Browse the repository at this point in the history
Replace SwatchAttributeType by Swatch Helper to ensure BC.
  • Loading branch information
afoucret authored Sep 5, 2018
2 parents aceb6e5 + 4197228 commit ec44c02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ class FrontPlugin
private $registry;

/**
* @var \Magento\Swatches\Model\SwatchAttributeType
* @var \Magento\Swatches\Helper\Data
*/
private $swatchAttributeType;
private $swatchHelper;

/**
* FrontPlugin constructor.
*
* @param \Magento\Framework\Registry $registry Registry
* @param \Magento\Swatches\Model\SwatchAttributeType $swatchAttributeType Swatch Attribute Type
* @param \Magento\Framework\Registry $registry Registry
* @param \Magento\Swatches\Helper\Data $swatchHelper Swatch Attribute Helper
*/
public function __construct(
\Magento\Framework\Registry $registry,
\Magento\Swatches\Model\SwatchAttributeType $swatchAttributeType
\Magento\Swatches\Helper\Data $swatchHelper
) {
$this->registry = $registry;
$this->swatchAttributeType = $swatchAttributeType;
$this->registry = $registry;
$this->swatchHelper = $swatchHelper;
}

/**
Expand All @@ -57,7 +57,7 @@ public function __construct(
*/
public function afterSetForm(\Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front $subject)
{
if ($this->getAttribute() && $this->swatchAttributeType->isSwatchAttribute($this->getAttribute())) {
if ($this->getAttribute() && $this->swatchHelper->isSwatchAttribute($this->getAttribute())) {
if ($subject->getForm() && $subject->getForm()->getElement('facet_max_size')) {
$subject->getForm()->getElement('facet_max_size')->setDisabled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
class SwatchAttribute
{
/**
* @var \Magento\Swatches\Model\SwatchAttributeType
* @var \Magento\Swatches\Helper\Data
*/
private $swatchAttributeType;
private $swatchHelper;

/**
* ProductAttribute constructor.
* FrontPlugin constructor.
*
* @param \Magento\Swatches\Model\SwatchAttributeType $swatchAttributeType Swatch Attribute Type
* @param \Magento\Swatches\Helper\Data $swatchHelper Swatch Attribute Helper
*/
public function __construct(\Magento\Swatches\Model\SwatchAttributeType $swatchAttributeType)
public function __construct(\Magento\Swatches\Helper\Data $swatchHelper)
{
$this->swatchAttributeType = $swatchAttributeType;
$this->swatchHelper = $swatchHelper;
}

/**
Expand All @@ -48,7 +48,7 @@ public function beforeAddFacetToCollection(
\Smile\ElasticsuiteCatalog\Model\Layer\Filter\Attribute $subject,
$config = []
) {
if ($this->swatchAttributeType->isSwatchAttribute($subject->getAttributeModel())) {
if ($this->swatchHelper->isSwatchAttribute($subject->getAttributeModel())) {
$config['size'] = 0;
}

Expand Down

0 comments on commit ec44c02

Please sign in to comment.