當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Action::dispatch方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\Action\Action::dispatch方法的典型用法代碼示例。如果您正苦於以下問題:PHP Action::dispatch方法的具體用法?PHP Action::dispatch怎麽用?PHP Action::dispatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\Action\Action的用法示例。


在下文中一共展示了Action::dispatch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dispatch

 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_getCheckout()->getCustomer()->getId()) {
         return $this->_redirect('customer/account/login');
     }
     return parent::dispatch($request);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:10,代碼來源:Address.php

示例2: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return ResponseInterface
  * @throws NotFoundException
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::dispatch($request);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:14,代碼來源:CardsManagement.php

示例3: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  * @throws \Magento\Framework\Exception\NotFoundException
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
         throw new NotFoundException(__('Page not found.'));
     }
     return parent::dispatch($request);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:Index.php

示例4: dispatch

 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_isAllowed()) {
         throw new NotFoundException(__('Page not found.'));
     }
     return parent::dispatch($request);
 }
開發者ID:fschell,項目名稱:magento2-developer-quickdevbar,代碼行數:11,代碼來源:Index.php

示例5: dispatch

 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::dispatch($request);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:13,代碼來源:Customer.php

示例6: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->getRequest()->isDispatched()) {
         parent::dispatch($request);
     }
     $result = parent::dispatch($request);
     return $result;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:CookieTester.php

示例7: dispatch

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     $loginUrl = $this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl();
     if (!$this->_customerSession->authenticate($this, $loginUrl)) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::dispatch($request);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:Products.php

示例8: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     $searchTerms = $this->scopeConfig->getValue('catalog/seo/search_terms', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     if (!$searchTerms) {
         $this->_redirect('noroute');
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::dispatch($request);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:15,代碼來源:Popular.php

示例9: dispatch

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$this->_getSession()->authenticate($this)) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::dispatch($request);
 }
開發者ID:Coplex,項目名稱:magento2,代碼行數:16,代碼來源:Agreement.php

示例10: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     // Check this module is enabled in frontend
     if ($this->_dataHelper->isEnabledInFrontend()) {
         $result = parent::dispatch($request);
         return $result;
     } else {
         $this->_forward('noroute');
     }
 }
開發者ID:rushvisilk,項目名稱:mage2-helloworld,代碼行數:16,代碼來源:Blog.php

示例11: dispatch

 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
         if (!$this->customerSession->getBeforeUrl()) {
             $this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
         }
     }
     return parent::dispatch($request);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:16,代碼來源:Add.php

示例12: dispatch

 public function dispatch(RequestInterface $request)
 {
     if (!$this->session->isLoggedIn()) {
         return $this->_redirect('customer/account/login');
     }
     if (!$this->config->isEnabled()) {
         return $this->_redirect($this->_redirect->getRefererUrl());
     }
     return parent::dispatch($request);
 }
開發者ID:Viktor-V,項目名稱:Facebook-Login,代碼行數:10,代碼來源:Index.php

示例13: dispatch

 /**
  * Check whether payment method is enabled
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->braintreePayPalConfig->isActive() || !$this->braintreePayPalConfig->isShortcutCheckoutEnabled()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('noRoute');
         return $resultRedirect;
     }
     return parent::dispatch($request);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:PayPal.php

示例14: dispatch

 /**
  * Check whether payment method is enabled
  *
  * @inheritdoc
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->config->isActive() || !$this->config->isDisplayShoppingCart()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
         /** @var Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('noRoute');
         return $resultRedirect;
     }
     return parent::dispatch($request);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:16,代碼來源:AbstractAction.php

示例15: dispatch

 /**
  * Make sure customer is logged in and put it into registry
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$this->_customerSession->authenticate($this)) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     $customer = $this->_customerSession->getCustomer();
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer);
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId());
     return parent::dispatch($request);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:19,代碼來源:RecurringPayment.php


注:本文中的Magento\Framework\App\Action\Action::dispatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。