abstract class SensorConfigurable in Monitoring 7
Abstract configurable sensor class.
Sensor extension providing generic functionality for custom sensor settings.
Custom sensor settings need to be implemented in an extending class.
Hierarchy
- class \Drupal\monitoring\Sensor\Sensor implements SensorInterface
- class \Drupal\monitoring\Sensor\SensorConfigurable implements SensorConfigurableInterface
Expanded class hierarchy of SensorConfigurable
4 files declare their use of SensorConfigurable
- SensorDisappearedSensors.php in lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorDisappearedSensors.php - Contains \Drupal\monitoring\Sensor\Sensors\SensorDisappearedSensors.
- SensorEnabledModules.php in lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorEnabledModules.php - Contains \Drupal\monitoring\Sensor\Sensors\SensorEnabledModules.
- SensorGitDirtyTree.php in lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorGitDirtyTree.php - Contains \Drupal\monitoring\Sensor\Sensors\SensorGitDirtyTree.
- SensorVariable.php in lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorVariable.php - Drupal\monitoring\Sensor\Sensors\SensorVariable.
File
- lib/
Drupal/ monitoring/ Sensor/ SensorConfigurable.php, line 17 - Contains \Drupal\monitoring\Sensor\SensorConfigurable.
Namespace
Drupal\monitoring\SensorView source
abstract class SensorConfigurable extends Sensor implements SensorConfigurableInterface {
/**
* {@inheritdoc}
*/
public function settingsForm($form, &$form_state) {
// If sensor provides settings form, automatically provide settings to
// enable the sensor.
$form['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled'),
'#description' => t('Check to have the sensor trigger.'),
'#default_value' => $this
->isEnabled(),
);
return $form;
}
/**
* {@inheritdoc}
*/
public function settingsFormValidate($form, &$form_state) {
// Do nothing.
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Sensor:: |
protected | property | Current sensor info object. | |
Sensor:: |
public | function |
Gets sensor name (not the label). Overrides SensorInterface:: |
|
Sensor:: |
public | function |
Determines if sensor is enabled. Overrides SensorInterface:: |
|
Sensor:: |
function | Instantiates a sensor object. | 1 | |
SensorConfigurable:: |
public | function |
Gets settings form for a specific sensor. Overrides SensorConfigurableInterface:: |
5 |
SensorConfigurable:: |
public | function |
Form validator for a sensor settings form. Overrides SensorConfigurableInterface:: |
1 |
SensorInterface:: |
function | Runs the sensor, updating $sensor_result. | 13 |