| Current Path : /var/www/magento.test.indacotrentino.com/www/app/code/Ashsmith/Blog/Controller/View/ |
| Current File : /var/www/magento.test.indacotrentino.com/www/app/code/Ashsmith/Blog/Controller/View/Index.php |
<?php
namespace Ashsmith\Blog\Controller\View;
use \Magento\Framework\App\Action\Action;
class Index extends Action
{
/** @var \Magento\Framework\Controller\Result\ForwardFactory */
protected $resultForwardFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public function __construct(\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
)
{
$this->resultForwardFactory = $resultForwardFactory;
parent::__construct($context);
}
/**
* Blog Index, shows a list of recent blog posts.
*
* @return \Magento\Framework\View\Result\PageFactory
*/
public function execute()
{
$post_id = $this->getRequest()->getParam('post_id', $this->getRequest()->getParam('id', false));
/** @var \Ashsmith\Blog\Helper\Post $post_helper */
$post_helper = $this->_objectManager->get('Ashsmith\Blog\Helper\Post');
$result_page = $post_helper->prepareResultPost($this, $post_id);
if (!$result_page) {
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('noroute');
}
return $result_page;
}
}