public function renderCheeseburgerMenuBlock::content in Cheeseburger Menu 8
Same name and namespace in other branches
- 8.4 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 29
Class
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function content(Request $request) {
//var_dump($request->getContent());
/*var_dump($request);
die();*/
/*$build = [
'#markup' => t('Hello World!'),
];
return $build;*/
$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 = \Drupal\block\Entity\Block::load($block_id);
if (!$block) {
return new Response('<div>No such block</div>');
}
$config = $block
->get('settings');
$tree = $this
->render_tree($route_id, $page_type, $current_route, $config);
/** @var \Drupal\Core\Render\Renderer $renderer */
$renderer = \Drupal::service('renderer');
$rendered_tree = $renderer
->render($tree);
//dsm($rendered_tree);
/*$build = [
'#markup' => t('Hello World!'),
];
return $build;*/
return new Response($rendered_tree);
}