Commit 021452d6 authored by alexpott's avatar alexpott

Issue #2121461 by Xano: \Drupal\Core\EventSubscriber\ViewSubscriber::onHtml()...

Issue #2121461 by Xano: \Drupal\Core\EventSubscriber\ViewSubscriber::onHtml() does not allow controllers to return string content.
parent 9d93bc36
......@@ -179,6 +179,12 @@ public function onHtml(GetResponseForControllerResultEvent $event) {
$page_callback_result = $event->getControllerResult();
$request = $event->getRequest();
// Convert string content to a renderable array, so we can set a title.
if (!is_array($page_callback_result)) {
$page_callback_result = array(
'#markup' => $page_callback_result,
);
}
// If no title was returned fall back to one defined in the route.
if (!isset($page_callback_result['#title'])) {
$page_callback_result['#title'] = $this->titleResolver->getTitle($request, $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT));
......
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