Tos Web Developer provides insights, tutorials, and advice around topics including content strategy, design, Drupal Development, Drupal Custom Module Development, Drupal 8 Custom themes, PHP, Server, Twig, and more



After lot of research, finally got the way to render blocks in twig files.

 Basically there are two type of renders. When there is an existing instance of the block in the layout.

The the block can be rendered in twig using preprocess as


$block = Block::load('serchform');
  $variables['block_content'] = \Drupal::entityTypeManager()
    ->getViewBuilder('block')
    ->view($block);
print render($variables);

No comments:

Post a Comment

| Designed And Blog Post by www.toswebdeveloper.com