public function RenderCheeseburgerMenuBlock::content in Cheeseburger Menu 8.4
Same name and namespace in other branches
- 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::content()
- 8.2 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 121 - 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');
$current_route = $request->request
->get('current_route');
$block = Block::load($block_id);
if (!$block) {
return new Response('<div>No such block</div>', 403);
}
$config = $block
->get('settings');
$tree = $this
->renderTree($config, $current_route, $block
->getPlugin()
->getDerivativeId());
$rendered_tree = $this->renderer
->render($tree);
return new Response($rendered_tree);
}