You are here

function monitoring_value_types in Monitoring 8

Same name and namespace in other branches
  1. 7 monitoring.module \monitoring_value_types()

Gets available value types definitions.

Return value

array Value type definitions, consisting of a label and an optional formatter_callback.

5 calls to monitoring_value_types()
MonitoringApiTest::testAPI in tests/src/Kernel/MonitoringApiTest.php
Test the base class if info is set and passed correctly.
SensorConfig::getValueLabel in src/Entity/SensorConfig.php
Gets sensor value label.
SensorConfig::isNumeric in src/Entity/SensorConfig.php
Determines if the sensor value is numeric.
SensorForm::form in src/Form/SensorForm.php
Gets the actual form array to be built.
SensorResult::getFormattedValue in src/Result/SensorResult.php
Formats the value to be human readable.

File

./monitoring.module, line 392
Monitoring bootstrap file.

Code

function monitoring_value_types() {

  // @todo Allow extension of those types through a hook or plugin system.
  return array(
    'no_value' => array(
      'label' => '- No value -',
      'numeric' => FALSE,
    ),
    'number' => array(
      'label' => 'Number',
      'numeric' => TRUE,
    ),
    'string' => array(
      'label' => 'Text',
      'numeric' => FALSE,
    ),
    'time_interval' => array(
      'label' => 'Time interval',
      'value_label' => 'Seconds',
      'formatter_callback' => 'monitoring_value_label_callback_interval',
      'numeric' => TRUE,
    ),
    'bool' => array(
      'label' => 'Boolean',
      'formatter_callback' => 'monitoring_value_label_callback_bool',
      'numeric' => FALSE,
    ),
  );
}