public function SensorInfo::getValueLabel in Monitoring 7
Gets sensor value label.
In case the sensor defines value_type, it will use the label provided for that type by monitoring_value_types().
Next it searches for the label within the sensor definition value_label.
If nothing is defined, it returns NULL.
Return value
string|null Sensor value label.
1 call to SensorInfo::getValueLabel()
- SensorInfo::toArray in lib/
Drupal/ monitoring/ Sensor/ SensorInfo.php - Compiles sensor info values to an associative array.
File
- lib/
Drupal/ monitoring/ Sensor/ SensorInfo.php, line 124 - Contains \Drupal\monitoring\Sensor\SensorInfo.
Class
- SensorInfo
- Represents a sensor info as defined in hook_monitoring_sensor_info().
Namespace
Drupal\monitoring\SensorCode
public function getValueLabel() {
if (isset($this->sensorInfo['value_label'])) {
return $this->sensorInfo['value_label'];
}
if ($value_type = $this
->getValueType()) {
$value_types = monitoring_value_types();
return $value_types[$value_type]['label'];
}
}