Commit 55a8203b authored by neclimdul's avatar neclimdul

Use a HttpKernel event to translate to a request

We return render arrays from requests ATM and until we transition to actual
request objects, we need to translate so Symfony can function.
parent cf096e69
......@@ -4,10 +4,11 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing;
use Symfony\Component\HttpKernel;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use Drupal\Core\UrlMatcher;
* Execute the page callback associated with given request.
......@@ -33,6 +34,11 @@ function router_execute_request(Request $request) {
$arguments = $resolver->getArguments($request, $controller);
$dispatcher = new EventDispatcher();
// Quick and dirty attempt at wrapping our rendering logic as is.
$dispatcher->addListener(KernelEvents::VIEW, function(Event $event) {
$page_callback_result = $event->getControllerResult();
$event->setResponse(new Response(drupal_render_page($page_callback_result)));
$kernel = new HttpKernel\HttpKernel($dispatcher, $resolver);
return $kernel->handle($request);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment