Skip to content

Commit

Permalink
Merge pull request #4734 from magento-tsg-csl3/MC-19197
Browse files Browse the repository at this point in the history
[TSG-CSL3] For 2.3 (MC-19197)
  • Loading branch information
viktym authored Sep 9, 2019
2 parents d93d288 + 5aaaaab commit 90b9c43
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions app/code/Magento/LayeredNavigation/Block/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Catalog layered navigation view block
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\LayeredNavigation\Block;

use Magento\Framework\View\Element\Template;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Catalog\Block\Product\ProductList\Toolbar;

/**
* Catalog layered navigation view block
*
* @api
* @since 100.0.2
*/
class Navigation extends \Magento\Framework\View\Element\Template
{
/**
* Product listing toolbar block name
*/
private const PRODUCT_LISTING_TOOLBAR_BLOCK = 'product_list_toolbar';

/**
* Catalog layer
*
Expand Down Expand Up @@ -67,9 +70,20 @@ protected function _prepareLayout()
$filter->apply($this->getRequest());
}
$this->getLayer()->apply();

return parent::_prepareLayout();
}

/**
* @inheritdoc
*/
protected function _beforeToHtml()
{
$this->configureToolbarBlock();

return parent::_beforeToHtml();
}

/**
* Get layer object
*
Expand Down Expand Up @@ -119,4 +133,20 @@ public function getClearUrl()
{
return $this->getChildBlock('state')->getClearUrl();
}

/**
* Configures the Toolbar block
*
* @return void
*/
private function configureToolbarBlock(): void
{
/** @var Toolbar $toolbarBlock */
$toolbarBlock = $this->getLayout()->getBlock(self::PRODUCT_LISTING_TOOLBAR_BLOCK);
if ($toolbarBlock) {
/** @var Collection $collection */
$collection = $this->getLayer()->getProductCollection();
$toolbarBlock->setCollection($collection);
}
}
}

0 comments on commit 90b9c43

Please sign in to comment.