Skip to content

Instantly share code, notes, and snippets.

View jessehs's full-sized avatar

Jesse Hofmann-Smith jessehs

  • Phase2 Technology
  • El Prado, New Mexico, USA
View GitHub Profile
@jessehs
jessehs / Blocks.md
Created May 14, 2020 14:39 — 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');