You are here

public function DatabaseAggregatorSensorPlugin::addFieldSubmit in Monitoring 8

Adds another field to the keys table when pressing 'Add another key'.

Parameters

array $form: The form structure array.

FormStateInterface $form_state: The form state structure.

File

src/Plugin/monitoring/SensorPlugin/DatabaseAggregatorSensorPlugin.php, line 679
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 addFieldSubmit(array $form, FormStateInterface $form_state) {
  $form_state
    ->setRebuild();
  $form_state
    ->set('fields_rows', $form_state
    ->get('fields_rows') + 1);
  $this
    ->messenger()
    ->addMessage(t('Field added.'));
}