You are here

protected function ContentItemBlock::loadEntity in Panopoly Widgets 8.2

Load the configured entity.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity or NULL if it doesn't exist or configuration is empty.

2 calls to ContentItemBlock::loadEntity()
ContentItemBlock::blockForm in src/Plugin/Block/ContentItemBlock.php
ContentItemBlock::build in src/Plugin/Block/ContentItemBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/ContentItemBlock.php, line 92

Class

ContentItemBlock
Block that displays a node.

Namespace

Drupal\panopoly_widgets\Plugin\Block

Code

protected function loadEntity() {
  if (!empty($this->configuration['nid'])) {
    $storage = $this->entityTypeManager
      ->getStorage('node');
    return $storage
      ->load($this->configuration['nid']);
  }
  return NULL;
}