summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Gilliland2012-02-13 21:02:34 (GMT)
committerJames Gilliland2012-02-13 21:02:34 (GMT)
commit55a8203bdb4cd20481c0a67a801b42a6a94c00a7 (patch)
tree37b5d396bbf77661647cd75f5ab0abebd4bda6b5
parentcf096e698a3bd9ce722614f838b0e43019887dbc (diff)
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.
-rw-r--r--core/includes/router.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/includes/router.inc b/core/includes/router.inc
index 153a44e..5830c8e 100644
--- a/core/includes/router.inc
+++ b/core/includes/router.inc
@@ -4,10 +4,11 @@ use Symfony\Component\HttpFoundation\Request;
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);