Skip to content
Snippets Groups Projects
Commit 021452d6 authored by Alex Pott's avatar Alex Pott
Browse files

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
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
......@@ -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));
......
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