public function BlockView::getBlock in Twig Extender 8
Same name and namespace in other branches
- 8.4 src/Plugin/TwigPlugin/BlockView.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockView::getBlock()
- 8.2 src/Plugin/TwigPlugin/BlockView.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockView::getBlock()
- 8.3 src/Plugin/TwigPlugin/BlockView.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockView::getBlock()
- 4.x src/Plugin/TwigPlugin/BlockView.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockView::getBlock()
Implementation for render block.
File
- src/
Plugin/ TwigPlugin/ BlockView.php, line 24
Class
- BlockView
- The plugin for check authenticated user.
Namespace
Drupal\twig_extender\Plugin\TwigPluginCode
public function getBlock($blockId) {
$block = Block::load($blockId);
if (!$block) {
return;
}
$blockContent = \Drupal::entityManager()
->getViewBuilder('block')
->view($block);
return \Drupal::service('renderer')
->render($blockContent);
}