init
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Mageplaza
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Mageplaza.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.mageplaza.com/LICENSE.txt
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Mageplaza
|
||||
* @package Mageplaza_Blog
|
||||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
|
||||
* @license https://www.mageplaza.com/LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Mageplaza\Blog\Controller\Adminhtml\History;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\Controller\Result\Redirect;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\Stdlib\DateTime\DateTime;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Mageplaza\Blog\Controller\Adminhtml\History;
|
||||
use Mageplaza\Blog\Model\PostFactory;
|
||||
use Mageplaza\Blog\Model\PostHistory;
|
||||
use Mageplaza\Blog\Model\PostHistoryFactory;
|
||||
|
||||
/**
|
||||
* Class Edit
|
||||
* @package Mageplaza\Blog\Controller\Adminhtml\History
|
||||
*/
|
||||
class Edit extends History
|
||||
{
|
||||
/**
|
||||
* Page factory
|
||||
*
|
||||
* @var PageFactory
|
||||
*/
|
||||
public $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Edit constructor.
|
||||
*
|
||||
* @param PostHistoryFactory $postHistoryFactory
|
||||
* @param PostFactory $postFactory
|
||||
* @param Registry $coreRegistry
|
||||
* @param DateTime $date
|
||||
* @param PageFactory $resultPageFactory
|
||||
* @param Context $context
|
||||
*/
|
||||
public function __construct(
|
||||
PostHistoryFactory $postHistoryFactory,
|
||||
PostFactory $postFactory,
|
||||
Registry $coreRegistry,
|
||||
DateTime $date,
|
||||
PageFactory $resultPageFactory,
|
||||
Context $context
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
parent::__construct($postHistoryFactory, $postFactory, $coreRegistry, $date, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Backend\Model\View\Result\Page|Redirect|Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var PostHistory $history */
|
||||
$history = $this->initPostHistory();
|
||||
|
||||
if (!$history) {
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
$resultRedirect->setPath('*');
|
||||
|
||||
return $resultRedirect;
|
||||
}
|
||||
|
||||
$this->coreRegistry->register('mageplaza_blog_post', $history);
|
||||
|
||||
/** @var \Magento\Backend\Model\View\Result\Page|Page $resultPage */
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu('Mageplaza_Blog::history');
|
||||
$resultPage->getConfig()->getTitle()->set(__('Post History'));
|
||||
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Edit Post History'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user