You are here

public function RenderCheeseburgerMenuBlock::content in Cheeseburger Menu 8.4

Same name and namespace in other branches
  1. 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::content()
  2. 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::content()
  3. 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::content()
1 string reference to 'RenderCheeseburgerMenuBlock::content'
cheeseburger_menu.routing.yml in ./cheeseburger_menu.routing.yml
cheeseburger_menu.routing.yml

File

src/Controller/RenderCheeseburgerMenuBlock.php, line 121
Controller used for rendering block.

Class

RenderCheeseburgerMenuBlock
Class RenderCheeseburgerMenuBlock.

Namespace

Drupal\cheeseburger_menu\Controller

Code

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);
}