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


PHP RequestInterface::getControllerName方法代碼示例

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


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

示例1: aroundDispatch

 /**
  * Replace standard admin login form with HTTP Basic authentication
  *
  * @param AbstractAction $subject
  * @param callable $proceed
  * @param RequestInterface $request
  * @return ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function aroundDispatch(AbstractAction $subject, \Closure $proceed, RequestInterface $request)
 {
     $resource = isset($this->aclResources[$request->getControllerName()]) ? isset($this->aclResources[$request->getControllerName()][$request->getActionName()]) ? $this->aclResources[$request->getControllerName()][$request->getActionName()] : $this->aclResources[$request->getControllerName()] : null;
     $type = $request->getParam('type');
     $resourceType = isset($this->aclResources[$type]) ? $this->aclResources[$type] : null;
     if (!$resource || !$resourceType) {
         return parent::aroundDispatch($subject, $proceed, $request);
     }
     $session = $this->_auth->getAuthStorage();
     // Try to login using HTTP-authentication
     if (!$session->isLoggedIn()) {
         list($login, $password) = $this->httpAuthentication->getCredentials();
         try {
             $this->_auth->login($login, $password);
         } catch (AuthenticationException $e) {
             $this->logger->critical($e);
         }
     }
     // Verify if logged in and authorized
     if (!$session->isLoggedIn() || !$this->authorization->isAllowed($resource) || !$this->authorization->isAllowed($resourceType)) {
         $this->httpAuthentication->setAuthenticationFailed('RSS Feeds');
         return $this->_response;
     }
     return parent::aroundDispatch($subject, $proceed, $request);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:36,代碼來源:BackendAuthentication.php

示例2: getStepByRequest

 /**
  * Get wizard step by request
  *
  * @param   \Magento\Framework\App\RequestInterface $request
  * @return  \Magento\Framework\Object|bool
  */
 public function getStepByRequest(\Magento\Framework\App\RequestInterface $request)
 {
     foreach ($this->_steps as $step) {
         if ($step->getController() == $request->getControllerName() && $step->getAction() == $request->getActionName()) {
             return $step;
         }
     }
     return false;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:15,代碼來源:Wizard.php

示例3: matchActionPath

 /**
  * Match controller name
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $param
  * @return string
  */
 protected function matchActionPath(\Magento\Framework\App\RequestInterface $request, $param)
 {
     if ($request->getControllerName()) {
         $actionPath = $request->getControllerName();
     } elseif (!empty($param)) {
         $actionPath = $param;
     } else {
         $actionPath = $this->_defaultPath->getPart('controller');
         $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
     }
     return $actionPath;
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:19,代碼來源:Base.php

示例4: getController

 /**
  * Retrieve the controller name
  *
  * @return string
  */
 protected function getController()
 {
     return $this->request->getControllerName();
 }
開發者ID:kid17,項目名稱:magento2,代碼行數:9,代碼來源:IframeConfigProvider.php

示例5: isTaxConfigPage

 /**
  * Return whether page is tax configuration
  *
  * @return bool
  */
 protected function isTaxConfigPage()
 {
     return $this->request->getModuleName() == 'admin' && $this->request->getControllerName() == 'system_config' && $this->request->getActionName() == 'edit' && $this->request->getParam('section') == 'tax';
 }
開發者ID:classyllama,項目名稱:ClassyLlama_AvaTax,代碼行數:9,代碼來源:ConfigNotification.php

示例6: isQueuePage

 /**
  * Return whether page is queue page
  *
  * @return bool
  */
 protected function isQueuePage()
 {
     return $this->request->getModuleName() == 'avatax' && $this->request->getControllerName() == 'queue' && $this->request->getActionName() == 'index';
 }
開發者ID:classyllama,項目名稱:ClassyLlama_AvaTax,代碼行數:9,代碼來源:QueueDisabledNotification.php


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