public function ConfigValueSensorPlugin::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/ ConfigValueSensorPlugin.php, line 95 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ConfigValueSensorPlugin
Class
- ConfigValueSensorPlugin
- Generic sensor that checks for a configuration value.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
public function calculateDependencies() {
$config_object = $this->sensorConfig
->getSetting('config');
$config = \Drupal::config($config_object);
if (isset($config) && isset($config
->getOriginal()['dependencies'])) {
$this
->addDependency('config', $config_object);
}
$this
->addDependency('module', strtok($config_object, '.'));
return $this->dependencies;
}