_getModel(); if (!$post->getId()) { throw new \Exception("Item is not longer exist.", 1); } $previewUrl = $this->_objectManager->get('\Magefan\Blog\Model\PreviewUrl'); $redirectUrl = $previewUrl->getUrl( $post, $previewUrl::CONTROLLER_POST ); $this->getResponse()->setRedirect($redirectUrl); } catch (\Exception $e) { $this->messageManager->addException( $e, __('Something went wrong %1', $e->getMessage()) ); $this->_redirect('*/*/edit', [$this->_idKey => $post->getId()]); } } }