Skip to content
Snippets Groups Projects
Commit de774078 authored by Larry Garfield's avatar Larry Garfield
Browse files

Fix namespace usage to Drupal standards.

parent 5ee04f81
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing; use Symfony\Component\Routing\RequestContext;
use Symfony\Component\HttpKernel; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
...@@ -22,14 +24,14 @@ function router_execute_request(Request $request) { ...@@ -22,14 +24,14 @@ function router_execute_request(Request $request) {
try { try {
// Resolve a routing context(path, etc) using the routes object to a // Resolve a routing context(path, etc) using the routes object to a
// Set a routing context to translate. // Set a routing context to translate.
$context = new Routing\RequestContext(); $context = new RequestContext();
$context->fromRequest($request); $context->fromRequest($request);
$matcher = new UrlMatcher($context); $matcher = new UrlMatcher($context);
// Push path paramaters into attributes. // Push path paramaters into attributes.
$request->attributes->add($matcher->match($request->getPathInfo())); $request->attributes->add($matcher->match($request->getPathInfo()));
// Get the controller(page callback) from the resolver. // Get the controller(page callback) from the resolver.
$resolver = new HttpKernel\Controller\ControllerResolver(); $resolver = new ControllerResolver();
$controller = $resolver->getController($request); $controller = $resolver->getController($request);
$arguments = $resolver->getArguments($request, $controller); $arguments = $resolver->getArguments($request, $controller);
...@@ -40,10 +42,10 @@ function router_execute_request(Request $request) { ...@@ -40,10 +42,10 @@ function router_execute_request(Request $request) {
$event->setResponse(new Response(drupal_render_page($page_callback_result))); $event->setResponse(new Response(drupal_render_page($page_callback_result)));
}); });
$kernel = new HttpKernel\HttpKernel($dispatcher, $resolver); $kernel = new HttpKernel($dispatcher, $resolver);
return $kernel->handle($request); return $kernel->handle($request);
} }
catch (Routing\Exception\ResourceNotFoundException $e) { catch (ResourceNotFoundException $e) {
$response = new Response('Not Found', 404); $response = new Response('Not Found', 404);
} }
//catch (Exception $e) { //catch (Exception $e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment