You are here

public function SensorVariable::settingsForm in Monitoring 7

Gets settings form for a specific sensor.

Parameters

$form: Drupal $form structure.

array $form_state: Drupal $form_state object. Carrying the string sensor_name.

Return value

array Drupal form structure.

Overrides SensorConfigurable::settingsForm

File

lib/Drupal/monitoring/Sensor/Sensors/SensorVariable.php, line 23
Drupal\monitoring\Sensor\Sensors\SensorVariable.

Class

SensorVariable
Monitors a variable value.

Namespace

Drupal\monitoring\Sensor\Sensors

Code

public function settingsForm($form, &$form_state) {
  $form = parent::settingsForm($form, $form_state);
  if (is_array($this->info
    ->getSetting('variable_value'))) {
    return $form;
  }
  $form['variable_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Expected value of variable %variable', array(
      '%variable' => $this->info
        ->getSetting('variable_name'),
    )),
    '#default_value' => $this->info
      ->getSetting('variable_value'),
  );
  return $form;
}