Commit dbe8913a authored by catch's avatar catch
Browse files

Issue #3443959: DialogRenderer::getTitleAsStringable() does not support all...

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

(cherry picked from commit 4a4a78b5)
parent eeb158fb
Loading
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -132,17 +132,9 @@ protected function getDialogOptions(Request $request): array {
   *   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;
  }