You are here

public function BulkEditForm::submitForm in Views Bulk Edit 8.2

Same name and namespace in other branches
  1. 8 src/Form/BulkEditForm.php \Drupal\views_bulk_edit\Form\BulkEditForm::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/BulkEditForm.php, line 117

Class

BulkEditForm
The bulk edit form.

Namespace

Drupal\views_bulk_edit\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->submitConfigurationForm($form, $form_state);
  foreach ($this
    ->getBulkEditEntityData() as $entity_type_id => $bundle_entities) {
    foreach ($bundle_entities as $bundle => $entities) {
      $entities = $this->entityTypeManager
        ->getStorage($entity_type_id)
        ->loadMultiple(array_keys($entities));
      foreach ($entities as $entity) {
        $this
          ->execute($entity);
      }
    }
  }
  $this
    ->clearBulkEditEntityData();
}