You are here

public function GroupForm::store in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Form/GroupForm.php \Drupal\group\Entity\Form\GroupForm::store()

Stores a group from the wizard step 1 in the temp store.

Parameters

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

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

See also

\Drupal\group\Entity\Controller\GroupController::addForm()

File

src/Entity/Form/GroupForm.php, line 131

Class

GroupForm
Form controller for the group add and edit forms.

Namespace

Drupal\group\Entity\Form

Code

public function store(array &$form, FormStateInterface $form_state) {

  // Store the unsaved group in the temp store.
  $store = $this->privateTempStoreFactory
    ->get($form_state
    ->get('group_wizard_id'));
  $store_id = $form_state
    ->get('store_id');
  $store
    ->set("{$store_id}:entity", $this
    ->getEntity());
  $store
    ->set("{$store_id}:step", 2);

  // Disable any URL-based redirect until the final step.
  $request = $this
    ->getRequest();
  $form_state
    ->setRedirect('<current>', [], [
    'query' => $request->query
      ->all(),
  ]);
  $request->query
    ->remove('destination');
}