Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php \Drupal\Core\Render\MainContent\ModalRenderer
- 9 core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php \Drupal\Core\Render\MainContent\ModalRenderer
Default main content renderer for modal dialog requests.
Hierarchy
- class \Drupal\Core\Render\MainContent\ModalRenderer extends \Drupal\Core\Render\MainContent\DialogRenderer
Expanded class hierarchy of ModalRenderer
1 file declares its use of ModalRenderer
- WideModalRenderer.php in core/
modules/ system/ tests/ modules/ dialog_renderer_test/ src/ Render/ MainContent/ WideModalRenderer.php
1 string reference to 'ModalRenderer'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses ModalRenderer
File
- core/
lib/ Drupal/ Core/ Render/ MainContent/ ModalRenderer.php, line 13
Namespace
Drupal\Core\Render\MainContentView source
class ModalRenderer extends DialogRenderer {
/**
* {@inheritdoc}
*/
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) {
$response = new AjaxResponse();
// First render the main content, because it might provide a title.
$content = $this->renderer
->renderRoot($main_content);
// Attach the library necessary for using the OpenModalDialogCommand and set
// the attachments for this Ajax response.
$main_content['#attached']['library'][] = 'core/drupal.dialog.ajax';
$response
->setAttachments($main_content['#attached']);
// Determine the title.
$title = $this
->getTitleAsStringable($main_content, $request, $route_match);
// Determine the dialog options for the OpenDialogCommand.
$options = $this
->getDialogOptions($request);
$response
->addCommand(new OpenModalDialogCommand($title, $content, $options));
return $response;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ModalRenderer:: |
public | function | 1 |