You are here

public function SensorConfig::calculateDependencies in Monitoring 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/SensorConfig.php, line 348
Contains \Drupal\monitoring\Entity\SensorConfig.

Class

SensorConfig
Represents a sensor config entity class.

Namespace

Drupal\monitoring\Entity

Code

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

  // Include the module of the sensor plugin as dependency and also allow it
  // to add additional dependencies based on the configuration.
  $instance = $this
    ->getPlugin();
  $definition = $instance
    ->getPluginDefinition();
  $this
    ->addDependency('module', $definition['provider']);

  // If a plugin is configurable, calculate its dependencies.
  if ($plugin_dependencies = $instance
    ->calculateDependencies()) {
    $this
      ->addDependencies($plugin_dependencies);
  }
  return $this->dependencies;
}