public function ContentEntityAggregatorSensorPlugin::calculateDependencies in Monitoring 8
Calculates dependencies for the configured plugin.
Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.
array(
'entity' => array(
'user.role.anonymous',
'user.role.authenticated',
),
'module' => array(
'node',
'user',
),
'theme' => array(
'seven',
),
);
Return value
array An array of dependencies grouped by type (module, theme, entity). For example:
Overrides SensorPluginBase::calculateDependencies
See also
\Drupal\Core\Config\Entity\ConfigDependencyManager
\Drupal\Core\Config\Entity\ConfigEntityInterface::getConfigDependencyName()
File
- src/
Plugin/ monitoring/ SensorPlugin/ ContentEntityAggregatorSensorPlugin.php, line 309 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ContentEntityAggregatorSensorPlugin.
Class
- ContentEntityAggregatorSensorPlugin
- Content entity database aggregator.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
public function calculateDependencies() {
$entity_type_id = $this->sensorConfig
->getSetting('entity_type');
if (!$entity_type_id) {
throw new \Exception(new FormattableMarkup('Sensor @id is missing the required entity_type setting.', array(
'@id' => $this
->id(),
)));
}
$entity_type = $this->entityTypeManager
->getDefinition($this->sensorConfig
->getSetting('entity_type'));
$this
->addDependency('module', $entity_type
->getProvider());
return $this->dependencies;
}