You are here

public function BatchUpdateForm::submitForm in Entity Usage 8

Same name and namespace in other branches
  1. 8.2 src/Form/BatchUpdateForm.php \Drupal\entity_usage\Form\BatchUpdateForm::submitForm()
  2. 8.3 src/Form/BatchUpdateForm.php \Drupal\entity_usage\Form\BatchUpdateForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/BatchUpdateForm.php, line 89

Class

BatchUpdateForm
Form to launch batch tracking of existing entities.

Namespace

Drupal\entity_usage\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $host_entity_types = array_filter($form_state
    ->getValue('host_entity_types'));

  // Generate a batch to recreate the statistics for all entities.
  // Note that if we force all statistics to be created, there is no need to
  // separate them between host / target cases. If all entities are going to
  // be re-tracked, tracking all of them as hosts is enough, because there
  // could never be a target without host.
  $batch = $this
    ->generateBatch($host_entity_types);
  batch_set($batch);
}