This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added active filter items to state and implemented getClearUrl method, …
…fixes #22
- Loading branch information
Freek Gruntjes
committed
Dec 14, 2017
1 parent
84631d6
commit 02d991a
Showing
9 changed files
with
125 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved | ||
* | ||
* @copyright Copyright (c) 2017-2017 Tweakwise.com B.V. (https://www.tweakwise.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace Emico\Tweakwise\Block\LayeredNavigation\Navigation\State; | ||
|
||
use Closure; | ||
use Emico\Tweakwise\Model\Catalog\Layer\Url; | ||
use Emico\Tweakwise\Model\Config; | ||
use Magento\LayeredNavigation\Block\Navigation\State; | ||
|
||
class Plugin | ||
{ | ||
/** | ||
* @var Url | ||
*/ | ||
private $url; | ||
|
||
/** | ||
* Plugin constructor. | ||
* | ||
* @param Config $config | ||
* @param Url $url | ||
*/ | ||
public function __construct(Config $config, Url $url) | ||
{ | ||
$this->config = $config; | ||
$this->url = $url; | ||
} | ||
|
||
/** | ||
* @param State $subject | ||
* @param Closure $proceed | ||
* @return array | ||
*/ | ||
public function aroundGetClearUrl(State $subject, Closure $proceed) | ||
{ | ||
if (!$this->config->isLayeredEnabled()) { | ||
return $proceed(); | ||
} | ||
|
||
return $this->url->getClearUrl($subject->getActiveFilters()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters