nortmas
5/12/2020 - 4:33 PM

Layout load block

<?php 

/**
 * Implements template_preprocess_layout().
 */
function umami_preprocess_layout(&$variables) {
  $block_storage = \Drupal::service('entity_type.manager')->getStorage('block_content');
  $node = \Drupal\node\Entity\Node::load(1);
  $contexts['layout_builder.entity'] = EntityContext::fromEntity($node);
  $section = $node->layout_builder__layout->getSections()[3];
  //$array = $section->toRenderArray($contexts);
  foreach ($section->getComponents() as $component) {
    $plugin = $component->getPlugin();
    if ($plugin->getBaseId() === 'inline_block') {
      $configuration = $plugin->getConfiguration();
      $block = $block_storage->loadRevision($configuration['block_revision_id']);
    }
  }
}