You are here

public function ContentEntityAggregatorSensorPlugin::addFieldSubmit in Monitoring 8

Adds sensor to entity when 'Add another field' button is pressed.

Parameters

array $form: The form structure array.

FormStateInterface $form_state: The form state structure.

File

src/Plugin/monitoring/SensorPlugin/ContentEntityAggregatorSensorPlugin.php, line 581
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ContentEntityAggregatorSensorPlugin.

Class

ContentEntityAggregatorSensorPlugin
Content entity database aggregator.

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.'));
}