当前位置: 首页>>代码示例>>PHP>>正文


PHP Action::execute方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Action\Action::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::execute方法的具体用法?PHP Action::execute怎么用?PHP Action::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Action\Action的用法示例。


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

示例1: execute

 /**
  * Check customer authentication for some actions
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->_customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:13,代码来源:Manage.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 public function execute(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_getCheckout()->getCustomer()->getId()) {
         return $this->_redirect('customer/account/login');
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:10,代码来源:Address.php

示例3: execute

 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:13,代码来源:Customer.php

示例4: execute

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  * @throws \Magento\Framework\Exception\NotFoundException
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
         throw new NotFoundException(__('Page not found.'));
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:14,代码来源:Index.php

示例5: execute

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $loginUrl = $this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl();
     if (!$this->_customerSession->authenticate($loginUrl)) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:14,代码来源:Products.php

示例6: execute

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::execute($request);
     }
     if (!$this->_getSession()->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:16,代码来源:Agreement.php

示例7: execute

 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
         if (!$this->customerSession->getBeforeUrl()) {
             $this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
         }
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:16,代码来源:Add.php

示例8: execute

 /**
  * Check whether payment method is enabled
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function execute(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::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:17,代码来源:PayPal.php

示例9: execute

 /**
  * Dispatch request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $searchTerms = $this->scopeConfig->getValue(
         'catalog/seo/search_terms',
         ScopeInterface::SCOPE_STORE
     );
     if (!$searchTerms) {
         $this->_redirect('noroute');
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:18,代码来源:Popular.php

示例10: execute

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $loginUrl = $this->customerUrl->getLoginUrl();
     if (!$this->customerSession->authenticate($loginUrl)) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     if (!$this->config->useVault()) {
         $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::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:21,代码来源:MyCreditCards.php

示例11: testExecute

 public function testExecute()
 {
     // Define test expectations
     $this->resultPageFactory->expects($this->once())->method('create')->willReturn($this->page);
     $this->assertSame($this->page, $this->controller->execute());
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:6,代码来源:AbstractActionTest.php

示例12: execute

 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_processUrlKeys()) {
         return parent::execute($request);
     }
     if ($request->isDispatched() && $request->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_response->setStatusHeader(403, '1.1', 'Forbidden');
         if (!$this->_auth->isLoggedIn()) {
             return $this->_redirect('*/auth/login');
         }
         $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false);
         $this->_view->renderLayout();
         $this->_request->setDispatched(true);
         return $this->_response;
     }
     if ($this->_isUrlChecked()) {
         $this->_actionFlag->set('', self::FLAG_IS_URLS_CHECKED, true);
     }
     $this->_processLocaleSettings();
     return parent::execute($request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:25,代码来源:AbstractAction.php

示例13: execute

 public function execute()
 {
     //        echo "ONE";
     //        exit;
     parent::execute();
 }
开发者ID:Balfin,项目名称:m2test,代码行数:6,代码来源:View.php

示例14: execute

    /**
     * Dispatch request
     *
     * @param RequestInterface $request
     * @return \Magento\Framework\App\ResponseInterface
     */
    public function execute(RequestInterface $request)
    {
        $allowGuest = $this->_objectManager->get('Magento\Review\Helper\Data')->getIsGuestAllowToWrite();
        if (!$request->isDispatched()) {
            return parent::execute($request);
        }

        if (!$allowGuest && $request->getActionName() == 'post' && $request->isPost()) {
            if (!$this->customerSession->isLoggedIn()) {
                $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
                $this->customerSession->setBeforeAuthUrl($this->_url->getUrl('*/*/*', ['_current' => true]));
                $this->_reviewSession->setFormData(
                    $request->getPostValue()
                )->setRedirectUrl(
                    $this->_redirect->getRefererUrl()
                );
                $this->getResponse()->setRedirect(
                    $this->_objectManager->get('Magento\Customer\Model\Url')->getLoginUrl()
                );
            }
        }

        return parent::execute($request);
    }
开发者ID:nblair,项目名称:magescotch,代码行数:30,代码来源:Product.php

示例15: execute

    /**
     * Check if module is enabled
     * If allow only for customer - redirect to login page
     *
     * @param RequestInterface $request
     * @return \Magento\Framework\App\ResponseInterface
     * @throws \Magento\Framework\Exception\NotFoundException
     */
    public function execute(RequestInterface $request)
    {
        /* @var $helper \Magento\SendFriend\Helper\Data */
        $helper = $this->_objectManager->get('Magento\SendFriend\Helper\Data');
        /* @var $session \Magento\Customer\Model\Session */
        $session = $this->_objectManager->get('Magento\Customer\Model\Session');

        if (!$helper->isEnabled()) {
            throw new NotFoundException(__('Page not found.'));
        }

        if (!$helper->isAllowForGuest() && !$session->authenticate()) {
            $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
            if ($this->getRequest()->getActionName() == 'sendemail') {
                $session->setBeforeAuthUrl($this->_url->getUrl('sendfriend/product/send', ['_current' => true]));
                $this->_objectManager->get('Magento\Catalog\Model\Session')
                    ->setSendfriendFormData($request->getPostValue());
            }
        }
        return parent::execute($request);
    }
开发者ID:nblair,项目名称:magescotch,代码行数:29,代码来源:Product.php


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