You are here

public function FixedBlockContent::calculateDependencies in Fixed Block Content 8

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

src/Entity/FixedBlockContent.php, line 229

Class

FixedBlockContent
Configuration entity for the fixed block content.

Namespace

Drupal\fixed_block_content\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();

  // Add dependency on the linked block content.
  if ($block_content = $this
    ->getBlockContent(FALSE)) {
    $this
      ->addDependency($block_content
      ->getConfigDependencyKey(), $block_content
      ->getConfigDependencyName());
  }

  // Add dependency on the configured block content type.
  $block_content_type = $this
    ->entityTypeManager()
    ->getStorage('block_content_type')
    ->load($this->block_content_bundle);
  $this
    ->addDependency($block_content_type
    ->getConfigDependencyKey(), $block_content_type
    ->getConfigDependencyName());
  return $this;
}