You are here

public function DatabaseAggregatorSensorPlugin::addConditionSubmit in Monitoring 8

Add row to table when pressing 'Add another condition' and rebuild.

Parameters

array $form: The form structure array.

FormStateInterface $form_state: The form state structure.

File

src/Plugin/monitoring/SensorPlugin/DatabaseAggregatorSensorPlugin.php, line 648
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\DatabaseAggregatorSensorPlugin.

Class

DatabaseAggregatorSensorPlugin
Database aggregator able to query a single db table.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function addConditionSubmit(array $form, FormStateInterface $form_state) {
  $form_state
    ->setRebuild();
  $form_state
    ->set('conditions_rows', $form_state
    ->get('conditions_rows') + 1);
  $this
    ->messenger()
    ->addMessage(t('Condition added.'));
}