I need to call my custom class like below as it is done in magento 1x
:
I need to Generate New Layered Navigation Menu
$viewPanel = $this->getLayout()->getBlock('catalog.leftnav')->toHtml();
$productList = $this->getLayout()->getBlock('product_list')->toHtml();
Should i use pageFactory
like as:
$viewPanel= $resultPageFactory->getLayout()->createBlock('Vendor\Module\Block\Product\ListProduct');
Or use:
$viewPanel= $this->_view->getLayout()->createBlock('Tagalys\Tglcatalog\Block\Product\ListProduct');
and _view is from use Magento\Framework\View\LayoutInterface;
?
Which is correct way of calling ?