You are here

protected function ConfigValueSensorPlugin::getValue in Monitoring 8

Gets the current value.

Return value

mixed The current value.

Overrides ValueComparisonSensorPluginBase::getValue

File

src/Plugin/monitoring/SensorPlugin/ConfigValueSensorPlugin.php, line 42
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ConfigValueSensorPlugin

Class

ConfigValueSensorPlugin
Generic sensor that checks for a configuration value.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function getValue() {
  $config = $this
    ->getConfig($this->sensorConfig
    ->getSetting('config'));
  $key = $this->sensorConfig
    ->getSetting('key');
  if (empty($key)) {
    return NULL;
  }
  return $config
    ->get($key);
}