You are here

public function SensorConfig::getDefinition in Monitoring 8

Compiles sensor values to an associative array.

Return value

array Sensor config associative array.

Overrides SensorConfigInterface::getDefinition

File

src/Entity/SensorConfig.php, line 305
Contains \Drupal\monitoring\Entity\SensorConfig.

Class

SensorConfig
Represents a sensor config entity class.

Namespace

Drupal\monitoring\Entity

Code

public function getDefinition() {
  $config = array(
    'sensor' => $this
      ->id(),
    'label' => $this
      ->getLabel(),
    'category' => $this
      ->getCategory(),
    'description' => $this
      ->getDescription(),
    'numeric' => $this
      ->isNumeric(),
    'value_label' => $this
      ->getValueLabel(),
    'caching_time' => $this
      ->getCachingTime(),
    'time_interval' => $this
      ->getTimeIntervalValue(),
    'enabled' => $this
      ->isEnabled(),
  );
  if ($this
    ->isDefiningThresholds()) {
    $config['thresholds'] = $this
      ->getThresholds();
  }
  return $config;
}