function monitoring_sensor_settings_form in Monitoring 7
Service sensors setting form.
1 string reference to 'monitoring_sensor_settings_form'
- monitoring_menu in ./
monitoring.module - Implements hook_menu().
File
- ./
monitoring.admin.inc, line 254 - Admin page/form callbacks.
Code
function monitoring_sensor_settings_form($form, &$form_state, SensorInfo $sensor_info) {
if (!$sensor_info
->isConfigurable()) {
return $form;
}
$sensor_class = $sensor_info
->getSensorClass();
/** @var SensorConfigurableInterface $sensor */
$sensor = new $sensor_class($sensor_info);
// Note that here we cannot set the sensor object as some sensor objects may
// carry with itself PDOStatements that cannot be serialised.
$form_state['sensor_name'] = $sensor_info
->getName();
$form_key = monitoring_sensor_settings_key($sensor_info
->getName());
$form[$form_key] = array(
'#tree' => TRUE,
);
$form[$form_key] = $sensor
->settingsForm($form[$form_key], $form_state);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}