Commit 2a4e4661 authored by webchick's avatar webchick
Browse files

Issue #2026037 by Crell: Check for legacy controllers based on the legacy...

Issue #2026037 by Crell: Check for legacy controllers based on the legacy flag, not the callable type.
parent 859642ea
......@@ -37,11 +37,11 @@ class LegacyControllerSubscriber implements EventSubscriberInterface {
*/
public function onKernelControllerLegacy(FilterControllerEvent $event) {
$request = $event->getRequest();
$router_item = $request->attributes->get('_drupal_menu_item');
$controller = $event->getController();
// This BC logic applies only to functions. Otherwise, skip it.
if (is_string($controller) && function_exists($controller)) {
// If we're dealing with a legacy route, wrap the controller in a closure
// so parameters still work.
if ($request->attributes->get('_legacy')) {
$router_item = $request->attributes->get('_drupal_menu_item');
$new_controller = function() use ($router_item) {
return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
};
......
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