You are here

protected function Multigraph::addSensorEntity in Monitoring 8

Loads the entity of a sensor and adds it to the end of the internal array.

Parameters

string $name: Sensor machine name.

string $label: (optional) Custom sensor label for this Multigraph.

2 calls to Multigraph::addSensorEntity()
Multigraph::addSensor in modules/multigraph/src/Entity/Multigraph.php
Includes a sensor.
Multigraph::getSensors in modules/multigraph/src/Entity/Multigraph.php
Gets the included sensors.

File

modules/multigraph/src/Entity/Multigraph.php, line 179
Contains \Drupal\monitoring_multigraph\Entity\Multigraph.

Class

Multigraph
Represents an aggregation of related sensors, called a multigraph.

Namespace

Drupal\monitoring_multigraph\Entity

Code

protected function addSensorEntity($name, $label = NULL) {
  $sensor = \Drupal::entityTypeManager()
    ->getStorage('monitoring_sensor_config')
    ->load($name);
  if (!empty($label)) {
    $sensor->label = $label;
  }
  $this->sensorEntities[] = $sensor;
}