You are here

public function ContentEntityAggregatorSensorPlugin::addConditionSubmit in Monitoring 8

Adds sensor to entity when 'Add another condition' 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 550
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ContentEntityAggregatorSensorPlugin.

Class

ContentEntityAggregatorSensorPlugin
Content entity database aggregator.

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