You are here

public function ProtectionRule::calculateDependencies in User protect 8

Overrides ConfigEntityBase::calculateDependencies().

Overrides ConfigEntityBase::calculateDependencies

File

src/Entity/ProtectionRule.php, line 239

Class

ProtectionRule
Defines the Protection rule entity.

Namespace

Drupal\userprotect\Entity

Code

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

  // Always add a dependency on the user module.
  $this
    ->addDependency('module', 'user');

  // Add a dependency on an user role in case this protection rule protects
  // an user role.
  $protected_entity = $this
    ->getProtectedEntity();
  if ($protected_entity instanceof ConfigEntityInterface) {
    $this
      ->addDependency('config', $protected_entity
      ->getConfigDependencyName());
  }
  return $this->dependencies;
}