You are here

public function MerciConfigureAction::submitForm in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2

File

modules/merci_line_item/src/Form/MerciConfigureAction.php, line 32

Class

MerciConfigureAction
Action configuration form.

Namespace

Drupal\merci_line_item\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_data = $form_state
    ->get('views_bulk_operations');
  $action = $this->actionManager
    ->createInstance($form_data['action_id']);
  if (method_exists($action, 'submitConfigurationForm')) {
    $action
      ->submitConfigurationForm($form, $form_state);
    $form_data['configuration'] = $action
      ->getConfiguration();
  }
  else {
    $form_state
      ->cleanValues();
    $form_data['configuration'] = $form_state
      ->getValues();
  }
  if ($form_state
    ->isRebuilding()) {
    return;
  }
  $definition = $this->actionManager
    ->getDefinition($form_data['action_id']);
  if (!empty($definition['confirm_form_route_name'])) {

    // Update tempStore data.
    $this
      ->setTempstoreData($form_data, $form_data['view_id'], $form_data['display_id']);

    // Go to the confirm route.
    $form_state
      ->setRedirect($definition['confirm_form_route_name'], [
      'view_id' => $form_data['view_id'],
      'display_id' => $form_data['display_id'],
    ]);
  }
  else {
    $this
      ->deleteTempstoreData($form_data['view_id'], $form_data['display_id']);
    $this->actionProcessor
      ->executeProcessing($form_data);
    $form_state
      ->setRedirectUrl($form_data['redirect_url']);
  }
}