Namespace
Drupal\colorbox_load
File
-
src/Renderer.php
View source
<?php
namespace Drupal\colorbox_load;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Render\MainContent\MainContentRendererInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\HttpFoundation\Request;
class Renderer implements MainContentRendererInterface {
protected $renderer;
public function __construct(RendererInterface $renderer) {
$this->renderer = $renderer;
}
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;
}
}
Classes
| Title |
Deprecated |
Summary |
| Renderer |
|
Render content in a colorbox. |