function SensorName::render in Monitoring 7
File
- lib/
Drupal/ monitoring/ Views/ Handler/ Field/ SensorName.php, line 20 - Contains \Drupal\monitoring\Views\Handler\Field\SensorName.
Class
- SensorName
- Views handler to output sensor label and name.
Namespace
Drupal\monitoring\Views\Handler\FieldCode
function render($values) {
/**
* @var SensorResultEntity $result
*/
$result = $this
->get_value($values);
try {
$sensor_info = monitoring_sensor_manager()
->getSensorInfoByName($result->sensor_name);
$label = $sensor_info
->getLabel();
} catch (NonExistingSensorException $e) {
$label = t('Disappeared sensor @name', array(
'@name' => $result->sensor_name,
));
}
return l($label, 'admin/reports/monitoring/sensors/' . $result->sensor_name);
}