public function RenderCheeseburgerMenuBlock::content in Cheeseburger Menu 8.2
Same name and namespace in other branches
- 8.4 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::content()
- 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::content()
- 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::content()
1 string reference to 'RenderCheeseburgerMenuBlock::content'
File
- src/
Controller/ RenderCheeseburgerMenuBlock.php, line 90 - Controller used for rendering block.
Class
- RenderCheeseburgerMenuBlock
- Class RenderCheeseburgerMenuBlock.
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function content(Request $request) {
$block_id = $request->request
->get('block_id');
$route_id = $request->request
->get('route_id');
$page_type = $request->request
->get('page_type');
$current_route = $request->request
->get('current_route');
$block = Block::load($block_id);
if (!$block) {
return new Response('<div>No such block</div>');
}
$config = $block
->get('settings');
$tree = $this
->renderTree($route_id, $page_type, $current_route, $config);
/** @var \Drupal\Core\Render\Renderer $renderer */
$renderer = $this->renderer;
$rendered_tree = $renderer
->render($tree);
return new Response($rendered_tree);
}