Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
- 9 core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
Namespace
Drupal\Core\Render\MainContent
File
core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
View source
<?php
namespace Drupal\Core\Render\MainContent;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\HttpFoundation\Request;
class ModalRenderer extends DialogRenderer {
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) {
$response = new AjaxResponse();
$content = $this->renderer
->renderRoot($main_content);
$main_content['#attached']['library'][] = 'core/drupal.dialog.ajax';
$response
->setAttachments($main_content['#attached']);
$title = $this
->getTitleAsStringable($main_content, $request, $route_match);
$options = $this
->getDialogOptions($request);
$response
->addCommand(new OpenModalDialogCommand($title, $content, $options));
return $response;
}
}
Classes
Name |
Description |
ModalRenderer |
Default main content renderer for modal dialog requests. |