• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Result\PageFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\View\Result\PageFactory的典型用法代码示例。如果您正苦于以下问题:PHP PageFactory类的具体用法?PHP PageFactory怎么用?PHP PageFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了PageFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _initAction

 /**
  * Init layout, menu and breadcrumb
  *
  * @return \Magento\Backend\Model\View\Result\Page
  */
 protected function _initAction()
 {
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Magento_Sales::sales_invoice')->addBreadcrumb(__('Sales'), __('Sales'))->addBreadcrumb(__('Invoices'), __('Invoices'));
     return $resultPage;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:12,代码来源:Index.php


示例2: executeInternal

 /**
  * Edit CMS block
  *
  * @return \Magento\Framework\Controller\ResultInterface
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function executeInternal()
 {
     // 1. Get ID and create model
     $id = $this->getRequest()->getParam('block_id');
     $model = $this->_objectManager->create('Magento\\Cms\\Model\\Block');
     // 2. Initial checking
     if ($id) {
         $model->load($id);
         if (!$model->getId()) {
             $this->messageManager->addError(__('This block no longer exists.'));
             /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
             $resultRedirect = $this->resultRedirectFactory->create();
             return $resultRedirect->setPath('*/*/');
         }
     }
     // 3. Set entered data if was error when we do save
     $data = $this->_objectManager->get('Magento\\Backend\\Model\\Session')->getFormData(true);
     if (!empty($data)) {
         $model->setData($data);
     }
     // 4. Register model to use later in blocks
     $this->_coreRegistry->register('cms_block', $model);
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     // 5. Build edit form
     $this->initPage($resultPage)->addBreadcrumb($id ? __('Edit Block') : __('New Block'), $id ? __('Edit Block') : __('New Block'));
     $resultPage->getConfig()->getTitle()->prepend(__('Blocks'));
     $resultPage->getConfig()->getTitle()->prepend($model->getId() ? $model->getTitle() : __('New Block'));
     return $resultPage;
 }
开发者ID:nblair,项目名称:magescotch,代码行数:36,代码来源:Edit.php


示例3: execute

 /**
  * Default customer account page
  *
  * @return \Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getConfig()->getTitle()->set(__('My Account'));
     return $resultPage;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Index.php


示例4: execute

 /**
  * @return \Magento\Backend\Model\View\Result\Forward
  */
 public function execute()
 {
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Ves_Setup::export')->addBreadcrumb(__('Ves Setup'), __('Ves Setup'))->addBreadcrumb(__('Export'), __('Export'));
     return $resultPage;
 }
开发者ID:rustamveer,项目名称:magento2,代码行数:10,代码来源:Index.php


示例5: execute

 /**
  * @return void
  */
 public function execute()
 {
     $ipId = $this->getRequest()->getParam('id');
     /** @var \Rapidmage\Firewall\Model\Ip $model */
     $model = $this->_ipFactory->create();
     if ($ipId) {
         $model->load($ipId);
         if (!$model->getId()) {
             $this->messageManager->addError(__('This Ip no longer exists.'));
             $this->_redirect('*/*/');
             return;
         }
     }
     // Restore previously entered form data from session
     $data = $this->_session->getIpData(true);
     if (!empty($data)) {
         $model->setData($data);
     }
     $this->_coreRegistry->register('firewall_blackip', $model);
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->_resultPageFactory->create();
     $resultPage->setActiveMenu('Rapidmage_Firewall::main_menu');
     $resultPage->getConfig()->getTitle()->prepend(__('Firewall'));
     return $resultPage;
 }
开发者ID:DRAJI,项目名称:Rapidmage,代码行数:28,代码来源:Edit.php


示例6: execute

 /**
  * Product edit form
  *
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
     $storeManager = $this->_objectManager->get('Magento\\Store\\Model\\StoreManagerInterface');
     $storeId = (int) $this->getRequest()->getParam('store', 0);
     $store = $storeManager->getStore($storeId);
     $storeManager->setCurrentStore($store->getCode());
     $productId = (int) $this->getRequest()->getParam('id');
     $product = $this->productBuilder->build($this->getRequest());
     if ($productId && !$product->getEntityId()) {
         $this->messageManager->addError(__('This product no longer exists.'));
         /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         return $resultRedirect->setPath('catalog/*/');
     }
     $this->_eventManager->dispatch('catalog_product_edit_action', ['product' => $product]);
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->addHandle('catalog_product_' . $product->getTypeId());
     $resultPage->setActiveMenu('Magento_Catalog::catalog_products');
     $resultPage->getConfig()->getTitle()->prepend(__('Products'));
     $resultPage->getConfig()->getTitle()->prepend($product->getName());
     if (!$this->_objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->isSingleStoreMode() && ($switchBlock = $resultPage->getLayout()->getBlock('store_switcher'))) {
         $switchBlock->setDefaultStoreName(__('Default Values'))->setWebsiteIds($product->getWebsiteIds())->setSwitchUrl($this->getUrl('catalog/*/*', ['_current' => true, 'active_tab' => null, 'tab' => null, 'store' => null]));
     }
     $block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
     if ($block) {
         $block->setStoreId($product->getStoreId());
     }
     return $resultPage;
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:36,代码来源:Edit.php


示例7: execute

 /**
  * Send confirmation link to specified email
  *
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     if ($this->session->isLoggedIn()) {
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('*/*/');
         return $resultRedirect;
     }
     // try to confirm by email
     $email = $this->getRequest()->getPost('email');
     if ($email) {
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         try {
             $this->customerAccountManagement->resendConfirmation($email, $this->storeManager->getStore()->getWebsiteId());
             $this->messageManager->addSuccess(__('Please check your email for confirmation key.'));
         } catch (InvalidTransitionException $e) {
             $this->messageManager->addSuccess(__('This email does not require confirmation.'));
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('Wrong email.'));
             $resultRedirect->setPath('*/*/*', ['email' => $email, '_secure' => true]);
             return $resultRedirect;
         }
         $this->session->setUsername($email);
         $resultRedirect->setPath('*/*/index', ['_secure' => true]);
         return $resultRedirect;
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getLayout()->getBlock('accountConfirmation')->setEmail($this->getRequest()->getParam('email', $email));
     return $resultPage;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:37,代码来源:Confirmation.php


示例8: testExecute

 public function testExecute()
 {
     $page = 'SamplePageObjectHere';
     $this->resultPageFactory->expects($this->once())->method('create')->willReturn($page);
     $result = $this->controller->execute();
     $this->assertEquals($page, $result);
 }
开发者ID:marcinNS,项目名称:magento2-samples,代码行数:7,代码来源:IndexTest.php


示例9: execute

 public function execute()
 {
     $this->resultPage = $this->resultPageFactory->create();
     $this->resultPage->setActiveMenu('YourCompanyName_GridController::modelname');
     $this->resultPage->getConfig()->getTitle()->set(__('GridController'));
     return $this->resultPage;
 }
开发者ID:santosh142,项目名称:magento2-sample-modules,代码行数:7,代码来源:Index.php


示例10: createPage

 /**
  * Initialize Layout and set breadcrumbs
  *
  * @return \Magento\Backend\Model\View\Result\Page
  */
 protected function createPage()
 {
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('SweetTooth_Webhook::system_webhook')->addBreadcrumb(__('Webhooks'), __('Webhooks'));
     return $resultPage;
 }
开发者ID:defyasdf,项目名称:magento2-module-webhook,代码行数:12,代码来源:Webhook.php


示例11: executeInternal

 /**
  * @return \Magento\Framework\View\Result\LayoutFactory
  */
 public function executeInternal()
 {
     $resultLayout = $this->resultPageFactory->create();
     $resultLayout->setStatusHeader(404, '1.1', 'Not Found');
     $resultLayout->setHeader('Status', '404 File not found');
     return $resultLayout;
 }
开发者ID:nblair,项目名称:magescotch,代码行数:10,代码来源:DefaultNoRoute.php


示例12: execute

 /**
  * Dispatch request
  *
  * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
  * @throws \Magento\Framework\Exception\NotFoundException
  */
 public function execute()
 {
     // 1. Get ID and create model
     $id = $this->getRequest()->getParam('id');
     $model = $this->_objectManager->create('Fastgento\\Storelocator\\Model\\Location');
     // 2. Initial checking
     if ($id) {
         $model->load($id);
         if (!$model->getId()) {
             $this->messageManager->addError(__('This block no longer exists.'));
             /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
             $resultRedirect = $this->resultRedirectFactory->create();
             return $resultRedirect->setPath('*/*/');
         }
     }
     // 3. Set entered data if was error when we do save
     $data = $this->_objectManager->get('Magento\\Backend\\Model\\Session')->getFormData(true);
     // 4. Register model to use later in blocks
     $this->_coreRegistry->register('location', $model);
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     if (is_array($data)) {
         if (isset($data['image']['delete'])) {
             $data['image'] = null;
         } else {
             unset($data['image']);
         }
         $model->addData($data);
     }
     // 5. Build edit form
     $this->initPage($resultPage)->addBreadcrumb($id ? __('Edit Location') : __('New Location'), $id ? __('Edit Location') : __('New Location'));
     //$resultPage->getConfig()->getTitle()->prepend(__('Locations'));
     //$resultPage->getConfig()->getTitle()->prepend($model->getId() ? $model->getName() : __('New Location'));
     return $resultPage;
 }
开发者ID:ant-workaholic,项目名称:Store-locator,代码行数:41,代码来源:Edit.php


示例13: execute

 /**
  * Action to reconfigure cart item
  *
  * @return \Magento\Framework\View\Result\Page|\Magento\Framework\Controller\Result\Redirect
  */
 public function execute()
 {
     // Extract item and product to configure
     $id = (int) $this->getRequest()->getParam('id');
     $productId = (int) $this->getRequest()->getParam('product_id');
     $quoteItem = null;
     if ($id) {
         $quoteItem = $this->cart->getQuote()->getItemById($id);
     }
     try {
         if (!$quoteItem || $productId != $quoteItem->getProduct()->getId()) {
             $this->messageManager->addError(__("We can't find the quote item."));
             return $this->resultRedirectFactory->create()->setPath('checkout/cart');
         }
         $params = new \Magento\Framework\Object();
         $params->setCategoryId(false);
         $params->setConfigureMode(true);
         $params->setBuyRequest($quoteItem->getBuyRequest());
         $resultPage = $this->resultPageFactory->create();
         $this->_objectManager->get('Magento\\Catalog\\Helper\\Product\\View')->prepareAndRender($resultPage, $quoteItem->getProduct()->getId(), $this, $params);
         return $resultPage;
     } catch (\Exception $e) {
         $this->messageManager->addError(__('We cannot configure the product.'));
         $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
         return $this->_goBack();
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:32,代码来源:Configure.php


示例14: execute

 /**
  * Promo quote edit action
  *
  * @return void
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function execute()
 {
     $id = $this->getRequest()->getParam('id');
     $model = $this->_objectManager->create('Magento\\SalesRule\\Model\\Rule');
     $this->_coreRegistry->register(\Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE, $model);
     $resultPage = $this->resultPageFactory->create();
     if ($id) {
         $model->load($id);
         if (!$model->getRuleId()) {
             $this->messageManager->addError(__('This rule no longer exists.'));
             $this->_redirect('sales_rule/*');
             return;
         }
         $resultPage->getLayout()->getBlock('promo_sales_rule_edit_tab_coupons')->setCanShow(true);
     }
     // set entered data if was error when we do save
     $data = $this->_objectManager->get('Magento\\Backend\\Model\\Session')->getPageData(true);
     if (!empty($data)) {
         $model->addData($data);
     }
     $model->getConditions()->setFormName('sales_rule_form');
     $model->getConditions()->setJsFormObject($model->getConditionsFieldSetId($model->getConditions()->getFormName()));
     $model->getActions()->setFormName('sales_rule_form');
     $model->getActions()->setJsFormObject($model->getActionsFieldSetId($model->getActions()->getFormName()));
     $this->_initAction();
     $this->_addBreadcrumb($id ? __('Edit Rule') : __('New Rule'), $id ? __('Edit Rule') : __('New Rule'));
     $this->_view->getPage()->getConfig()->getTitle()->prepend($model->getRuleId() ? $model->getName() : __('New Cart Price Rule'));
     $this->_view->renderLayout();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:Edit.php


示例15: testExecuteOrderLoaded

 /**
  * @return void
  */
 public function testExecuteOrderLoaded()
 {
     $this->guestHelperMock->expects($this->once())->method('loadValidOrder')->with($this->requestMock)->willReturn(true);
     $this->resultPageFactoryMock->expects($this->once())->method('create')->willReturn($this->resultPageMock);
     $this->guestHelperMock->expects($this->once())->method('getBreadcrumbs')->with($this->resultPageMock);
     $this->assertSame($this->resultPageMock, $this->viewController->execute());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:ViewTest.php


示例16: execute

 /**
  * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect|\Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     $id = $this->getRequest()->getParam('post_id');
     /** @var \Mageplaza\Blog\Model\Post $post */
     $post = $this->initPost();
     /** @var \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Mageplaza_Blog::post');
     $resultPage->getConfig()->getTitle()->set(__('Posts'));
     if ($id) {
         $post->load($id);
         if (!$post->getId()) {
             $this->messageManager->addError(__('This Post no longer exists.'));
             $resultRedirect = $this->resultRedirectFactory->create();
             $resultRedirect->setPath('mageplaza_blog/*/edit', ['post_id' => $post->getId(), '_current' => true]);
             return $resultRedirect;
         }
     }
     $title = $post->getId() ? $post->getName() : __('New Post');
     $resultPage->getConfig()->getTitle()->prepend($title);
     $data = $this->backendSession->getData('mageplaza_blog_post_data', true);
     if (!empty($data)) {
         $post->setData($data);
     }
     return $resultPage;
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:29,代码来源:Edit.php


示例17: execute

 /**
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     if (!$this->_validateProducts()) {
         return $this->resultRedirectFactory->create()->setPath('catalog/product/', ['_current' => true]);
     }
     return $this->resultPageFactory->create();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:10,代码来源:Edit.php


示例18: executeInternal

 /**
  * Resetting password handler
  *
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
  */
 public function executeInternal()
 {
     $resetPasswordToken = (string) $this->getRequest()->getParam('token');
     $customerId = (int) $this->getRequest()->getParam('id');
     $isDirectLink = $resetPasswordToken != '' && $customerId != 0;
     if (!$isDirectLink) {
         $resetPasswordToken = (string) $this->session->getRpToken();
         $customerId = (int) $this->session->getRpCustomerId();
     }
     try {
         $this->accountManagement->validateResetPasswordLinkToken($customerId, $resetPasswordToken);
         if ($isDirectLink) {
             $this->session->setRpToken($resetPasswordToken);
             $this->session->setRpCustomerId($customerId);
             $resultRedirect = $this->resultRedirectFactory->create();
             $resultRedirect->setPath('*/*/createpassword');
             return $resultRedirect;
         } else {
             /** @var \Magento\Framework\View\Result\Page $resultPage */
             $resultPage = $this->resultPageFactory->create();
             $resultPage->getLayout()->getBlock('resetPassword')->setCustomerId($customerId)->setResetPasswordLinkToken($resetPasswordToken);
             return $resultPage;
         }
     } catch (\Exception $exception) {
         $this->messageManager->addError(__('Your password reset link has expired.'));
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('*/*/forgotpassword');
         return $resultRedirect;
     }
 }
开发者ID:nblair,项目名称:magescotch,代码行数:36,代码来源:CreatePassword.php


示例19: _initAction

 /**
  * @return \Magento\Framework\View\Result\Page
  */
 protected function _initAction()
 {
     // load layout, set active menu, breadcrumbs
     $resultPage = $this->resultPageFactory->create();
     $resultPage->setActiveMenu('Pyvil_Blog::post')->addBreadcrumb(__('Blog'), __('Blog'))->addBreadcrumb(__('Manage blog posts'), __('Manage blog posts'));
     return $resultPage;
 }
开发者ID:pyvil,项目名称:magento2-blog-module,代码行数:10,代码来源:Edit.php


示例20: execute

 /**
  * @return \Magento\Backend\Model\View\Result\Page
  */
 public function execute()
 {
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getConfig()->getTitle()->prepend(__('Sentinel Login Logs'));
     return $resultPage;
 }
开发者ID:ajzele,项目名称:Foggyline_Sentinel,代码行数:10,代码来源:Index.php



注:本文中的Magento\Framework\View\Result\PageFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mtf\ObjectManager类代码示例发布时间:2022-05-23
下一篇:
PHP Result\Page类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap