<?php


namespace Magetop\Advancepreview\Controller\Index;

use Magento\Framework\App\Action\Context;
use Magento\Checkout\Model\Cart as CustomerCart;
class Index extends  \Magento\Framework\App\Action\Action
{
    protected $pageFactory;
    public function __construct(
        Context $context,
        \Magento\Framework\View\Result\PageFactory $pageFactory
    )
    {
        parent::__construct($context);
        $this->pageFactory = $pageFactory;
    }

    public function execute()
    {
        $resultPageFactory = $this->pageFactory->create();
        // Add page title
        $resultPageFactory->getConfig()->getTitle()->set(__('Downloading'));
        // Add breadcrumb
        /** @var \Magento\Theme\Block\Html\Breadcrumbs */
        if($resultPageFactory->getLayout()->getBlock('breadcrumbs'))
        {
            $breadcrumbs = $resultPageFactory->getLayout()->getBlock('breadcrumbs');
            $breadcrumbs->addCrumb('home',
                [
                    'label' => __('Home'),
                    'title' => __('Home'),
                    'link' => $this->_url->getUrl('')
                ]
            );
            $breadcrumbs->addCrumb('preview_custom_download',
                [
                    'label' => __('Downloading'),
                    'title' => __('Downloading')
                ]
            );
        }
        return $resultPageFactory;
    }
}
