You are here

public function BlockContentTab::getContent in Block Tabs 8

Returns the content of the tab.

Return value

string The content of the tab.

Overrides TabBase::getContent

File

src/Plugin/Tab/BlockContentTab.php, line 83

Class

BlockContentTab
Block content tab.

Namespace

Drupal\blocktabs\Plugin\Tab

Code

public function getContent() {
  $block_render_array = NULL;
  $block_uuid = $this->configuration['block_uuid'];
  if (!empty($block_uuid)) {
    $block = \Drupal::service('entity.repository')
      ->loadEntityByUuid('block_content', $block_uuid);
    $block_render_array = \Drupal::entityTypeManager()
      ->getViewBuilder($block
      ->getEntityTypeId())
      ->view($block, 'default');
  }
  return $block_render_array;
}