_helperBlog = $helperData; $this->resultPageFactory = $resultPageFactory; $this->resultForwardFactory = $resultForwardFactory; $this->authorCollection = $authorCollection; $this->customerSession = $customerSession; $this->coreRegistry = $coreRegistry; parent::__construct($context); } /** * @return ResponseInterface|Redirect|ResultInterface|Page */ public function execute() { $resultRedirect = $this->resultRedirectFactory->create(); $this->_helperBlog->setCustomerContextId(); if (!$this->_helperBlog->isAuthor() && $this->_helperBlog->isLogin() && $this->getRequest()->isAjax() ) { $page = $this->resultPageFactory->create(); if ($this->getRequest()->getParam('postId')) { $author = $this->_helperBlog->getCurrentAuthor(); $this->coreRegistry->register('mp_author', $author); $page->getConfig()->getTitle()->set($author->getName()); } $page->getConfig()->setPageLayout('1column'); $this->_view->loadLayout(); $layout = $this->_view->getLayout(); $this->getResponse()->setBody($layout->renderElement('main.content')); return $page; } else { $resultRedirect->setPath('customer/account'); return $resultRedirect; } } }