Skip to content

Instantly share code, notes, and snippets.

@khaledWebdev
khaledWebdev / Blocks.md
Created March 6, 2020 09:18 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
html,
body {
height: 100%;
}