class Renderer in Colorbox Load 8
Render content in a colorbox.
Hierarchy
- class \Drupal\colorbox_load\Renderer implements MainContentRendererInterface
Expanded class hierarchy of Renderer
1 string reference to 'Renderer'
1 service uses Renderer
File
- src/
Renderer.php, line 14
Namespace
Drupal\colorbox_loadView source
class Renderer implements MainContentRendererInterface {
/**
* The renderer service.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected $renderer;
/**
* Constructs a new HtmlRenderer.
*
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer service.
*/
public function __construct(RendererInterface $renderer) {
$this->renderer = $renderer;
}
/**
* {@inheritdoc}
*/
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) {
$response = new AjaxResponse();
$content = $this->renderer
->renderPlain($main_content);
$response
->setAttachments($main_content['#attached']);
$response
->addCommand(new OpenCommand($content));
return $response;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Renderer:: |
protected | property | The renderer service. | |
Renderer:: |
public | function |
Renders the main content render array into a response. Overrides MainContentRendererInterface:: |
|
Renderer:: |
public | function | Constructs a new HtmlRenderer. |