public function BlockCreate::getBlock in Twig Extender 8
Same name and namespace in other branches
- 8.4 src/Plugin/TwigPlugin/BlockCreate.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockCreate::getBlock()
- 8.2 src/Plugin/TwigPlugin/BlockCreate.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockCreate::getBlock()
- 8.3 src/Plugin/TwigPlugin/BlockCreate.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockCreate::getBlock()
- 4.x src/Plugin/TwigPlugin/BlockCreate.php \Drupal\twig_extender\Plugin\TwigPlugin\BlockCreate::getBlock()
Implementation for render block.
File
- src/
Plugin/ TwigPlugin/ BlockCreate.php, line 23
Class
- BlockCreate
- The plugin for check authenticated user.
Namespace
Drupal\twig_extender\Plugin\TwigPluginCode
public function getBlock($pluginId, $conf = []) {
$block_plugin_manager = \Drupal::service('plugin.manager.block');
/** @var \Drupal\language\Plugin\Block\LanguageBlock $language_block */
$block = $block_plugin_manager
->createInstance($pluginId, $conf);
if (!$block) {
return;
}
$build = $block
->build();
return \Drupal::service('renderer')
->render($build);
}