init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\SeventeenTrack\Controller\Adminhtml\Log;
|
||||
|
||||
use Esun\SeventeenTrack\Model\ApiLogFactory;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Framework\Controller\Result\Redirect;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class View extends Action
|
||||
{
|
||||
public const ADMIN_RESOURCE = 'Esun_SeventeenTrack::logs';
|
||||
|
||||
public function __construct(
|
||||
Action\Context $context,
|
||||
private readonly PageFactory $pageFactory,
|
||||
private readonly ApiLogFactory $apiLogFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute(): Page|Redirect
|
||||
{
|
||||
$log = $this->apiLogFactory->create()->load((int)$this->getRequest()->getParam('id'));
|
||||
if (!$log->getId()) {
|
||||
$this->messageManager->addErrorMessage(__('The 17TRACK API log no longer exists.'));
|
||||
return $this->resultRedirectFactory->create()->setPath('*/*/index');
|
||||
}
|
||||
$page = $this->pageFactory->create();
|
||||
$page->setActiveMenu(self::ADMIN_RESOURCE);
|
||||
$page->getConfig()->getTitle()->prepend(__('17TRACK API Log #%1', $log->getId()));
|
||||
return $page;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user