public function SensorForm::submitSelectPlugin in Monitoring 8
Handles submit call when sensor type is selected.
File
- src/
Form/ SensorForm.php, line 212 - Contains \Drupal\monitoring\Form\SensorForm.
Class
- SensorForm
- Sensor settings form controller.
Namespace
Drupal\monitoring\FormCode
public function submitSelectPlugin(array $form, FormStateInterface $form_state) {
$this->entity = $this
->buildEntity($form, $form_state);
// Set default configuration of the sensor.
$default_config = (array) $this->entity
->getPlugin()
->getDefaultConfiguration();
$default_config += array(
'settings' => array(),
);
foreach ($default_config as $key => $value) {
$this->entity
->set($key, $value);
}
$form_state
->setRebuild();
}