You are here

public function SensorManager::getSensorConfigByCategories in Monitoring 8

Gets sensor config grouped by categories.

@todo: The enabled flag is strange, FALSE should return all?

Parameters

bool $enabled: Sensor isEnabled flag.

Return value

\Drupal\monitoring\Entity\SensorConfig[][] Sensor config.

File

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

Class

SensorManager
Manages sensor definitions and settings.

Namespace

Drupal\monitoring\Sensor

Code

public function getSensorConfigByCategories($enabled = TRUE) {
  $config_by_categories = array();
  foreach ($this
    ->getAllSensorConfig() as $sensor_name => $sensor_config) {
    if ($sensor_config
      ->isEnabled() != $enabled) {
      continue;
    }
    $config_by_categories[$sensor_config
      ->getCategory()][$sensor_name] = $sensor_config;
  }
  return $config_by_categories;
}