Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
NoRouteHandler Class Reference
Inheritance diagram for NoRouteHandler:
NoRouteHandlerInterface

Public Member Functions

 __construct (\Magento\Backend\Helper\Data $helper, \Magento\Framework\App\Route\ConfigInterface $routeConfig)
 
 process (\Magento\Framework\App\RequestInterface $request)
 
- Public Member Functions inherited from NoRouteHandlerInterface
 process (\Magento\Framework\App\RequestInterface $request)
 

Protected Attributes

 $helper
 
 $routeConfig
 

Detailed Description

@api

Since
100.0.2

Definition at line 14 of file NoRouteHandler.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Backend\Helper\Data  $helper,
\Magento\Framework\App\Route\ConfigInterface  $routeConfig 
)
Parameters
\Magento\Backend\Helper\Data$helper
\Magento\Framework\App\Route\ConfigInterface$routeConfig

Definition at line 30 of file NoRouteHandler.php.

33  {
34  $this->helper = $helper;
35  $this->routeConfig = $routeConfig;
36  }

Member Function Documentation

◆ process()

Check and process no route request

Parameters
\Magento\Framework\App\RequestInterface$request
Returns
bool

Definition at line 44 of file NoRouteHandler.php.

45  {
46  $requestPathParams = explode('/', trim($request->getPathInfo(), '/'));
47  $areaFrontName = array_shift($requestPathParams);
48 
49  if ($areaFrontName === $this->helper->getAreaFrontName(true)) {
50  $moduleName = $this->routeConfig->getRouteFrontName('adminhtml');
51  $actionNamespace = 'noroute';
52  $actionName = 'index';
53  $request->setModuleName($moduleName)->setControllerName($actionNamespace)->setActionName($actionName);
54  return true;
55  }
56  return false;
57  }

Field Documentation

◆ $helper

$helper
protected

Definition at line 19 of file NoRouteHandler.php.

◆ $routeConfig

$routeConfig
protected

Definition at line 24 of file NoRouteHandler.php.


The documentation for this class was generated from the following file: