@api
Overrides RequestMatcherInterface::matchRequest
public function matchRequest(Request $request) {
if ($router_item = $this
->matchDrupalItem($request->attributes
->get('system_path'))) {
$ret = $this
->convertDrupalItem($router_item);
// Stash the router item in the attributes while we're transitioning.
$ret['drupal_menu_item'] = $router_item;
// Most legacy controllers (aka page callbacks) are in a separate file,
// so we have to include that.
if ($router_item['include_file']) {
require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
}
// Flag this as a legacy request. We need to use this for subrequest
// handling so that we can treat older page callbacks and new routes
// differently.
// @todo Remove this line as soon as possible.
$ret['_legacy'] = TRUE;
return $ret;
}
// This matcher doesn't differentiate by method, so don't bother with those
// exceptions.
throw new ResourceNotFoundException();
}