You are here

class SensorName in Monitoring 7

Views handler to output sensor label and name.

Hierarchy

  • class \Drupal\monitoring\Views\Handler\Field\SensorName extends \Drupal\monitoring\Views\Handler\Field\views_handler_field_entity

Expanded class hierarchy of SensorName

File

lib/Drupal/monitoring/Views/Handler/Field/SensorName.php, line 15
Contains \Drupal\monitoring\Views\Handler\Field\SensorName.

Namespace

Drupal\monitoring\Views\Handler\Field
View source
class SensorName extends \views_handler_field_entity {

  /**
   * {@inheritdoc}
   */
  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);
  }

}

Members