Issue #3443959: DialogRenderer::getTitleAsStringable() does not support all return types of TitleResolverInterface::getTitle()

merge-requests/7934/head
catch 2024-05-06 21:09:22 +01:00
parent 966fd63a6c
commit 4a4a78b5ba
1 changed files with 3 additions and 11 deletions

View File

@ -132,17 +132,9 @@ class DialogRenderer implements MainContentRendererInterface {
* The title as a string or stringable object.
*/
protected function getTitleAsStringable(array $main_content, Request $request, RouteMatchInterface $route_match): \Stringable|string|null {
$title = NULL;
if (array_key_exists('#title', $main_content)) {
if (is_array($main_content['#title'])) {
$title = $this->renderer->renderInIsolation($main_content['#title']);
}
else {
$title = $main_content['#title'];
}
}
elseif ($this->titleResolver->getTitle($request, $route_match->getRouteObject())) {
$title = $this->titleResolver->getTitle($request, $route_match->getRouteObject())->render();
$title = $main_content['#title'] ?? $this->titleResolver->getTitle($request, $route_match->getRouteObject());
if (is_array($title)) {
$title = $this->renderer->renderInIsolation($title);
}
return $title;
}