You are here

public function SensorManager::getEnabledSensorConfig in Monitoring 8

Returns monitoring sensor config for enabled sensors.

Return value

\Drupal\monitoring\Entity\SensorConfig[] List of SensorConfig instances.

File

src/Sensor/SensorManager.php, line 118
Contains \Drupal\monitoring\Sensor\SensorManager.

Class

SensorManager
Manages sensor definitions and settings.

Namespace

Drupal\monitoring\Sensor

Code

public function getEnabledSensorConfig() {
  $enabled_sensors = array();
  foreach ($this
    ->getAllSensorConfig() as $sensor_config) {
    if ($sensor_config
      ->isEnabled()) {
      $enabled_sensors[$sensor_config
        ->id()] = $sensor_config;
    }
  }
  return $enabled_sensors;
}