38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
namespace Edeclic\News\Controller\Index;
|
|
|
|
use Magento\Framework\App\Action\Context;
|
|
use Magento\Framework\View\Result\PageFactory;
|
|
|
|
class View extends \Magento\Framework\App\Action\Action
|
|
{
|
|
|
|
public function __construct(
|
|
Context $context,
|
|
PageFactory $resultPageFactory
|
|
)
|
|
{
|
|
parent::__construct($context);
|
|
$this->resultPageFactory = $resultPageFactory;
|
|
}
|
|
|
|
public function execute()
|
|
{
|
|
$id = $this->getRequest()->getParams()['id'];
|
|
$objectManager = $this->_objectManager->create('Edeclic\News\Model\News');
|
|
$news = $objectManager->load($id);
|
|
$resultPageFactory = $this->resultPageFactory->create();
|
|
|
|
$resultPageFactory->getConfig()->getTitle()->set(__($news->getTitre()));
|
|
|
|
$breadcrumbs = $resultPageFactory->getLayout()->getBlock('breadcrumbs');
|
|
$breadcrumbs->addCrumb('home',['label' => __('Home'),'title' => __('Home'),'link' => $this->_url->getUrl('')]);
|
|
$breadcrumbs->addCrumb('news',['label' => __('News'),'title' => __('News'),'link' => '/news/liste']);
|
|
$breadcrumbs->addCrumb('news_item',['label' => __($news->getTitre()),'title' => __($news->getTitre())]);
|
|
|
|
return $resultPageFactory;
|
|
|
|
}
|
|
|
|
|
|
} |