You are here

public function Render::renderBlock in Bamboo Twig 8.3

Same name and namespace in other branches
  1. 8.5 bamboo_twig_loader/src/TwigExtension/Render.php \Drupal\bamboo_twig_loader\TwigExtension\Render::renderBlock()
  2. 8.2 bamboo_twig_loader/src/TwigExtension/Render.php \Drupal\bamboo_twig_loader\TwigExtension\Render::renderBlock()
  3. 8.4 bamboo_twig_loader/src/TwigExtension/Render.php \Drupal\bamboo_twig_loader\TwigExtension\Render::renderBlock()

Load a given block with or whitout parameters.

Parameters

string $block_id: The ID of the block to render.

array $params: (optional) An array of parameters passed to the block.

Return value

null|array A render array for the block or NULL if the block does not exist.

File

bamboo_twig_loader/src/TwigExtension/Render.php, line 49

Class

Render
Provides some renderer as Twig Extensions.

Namespace

Drupal\bamboo_twig_loader\TwigExtension

Code

public function renderBlock($block_id, array $params = []) {
  $instance = $this
    ->getPluginManagerBlock()
    ->createInstance($block_id, $params);
  return $instance
    ->build($params);
}