public function Multigraph::addSensor in Monitoring 8
Includes a sensor.
Parameters
string $name: The machine name of the sensor that should be included by the multigraph.
string $label: (optional) Custom label for the sensor within the multigraph.
Overrides MultigraphInterface::addSensor
File
- modules/
multigraph/ src/ Entity/ Multigraph.php, line 135 - Contains \Drupal\monitoring_multigraph\Entity\Multigraph.
Class
- Multigraph
- Represents an aggregation of related sensors, called a multigraph.
Namespace
Drupal\monitoring_multigraph\EntityCode
public function addSensor($name, $label = NULL) {
$this->sensors[$name] = array(
'label' => $label,
'weight' => $this->sensors ? 1 + max(array_map(function ($mapping) {
return $mapping['weight'];
}, $this->sensors)) : 0,
);
$this
->addSensorEntity($name, $label);
}