You are here

public function GroupContentForm::back in Group 8

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

Goes back to step 1 of the creation wizard.

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\GroupContentController::createForm()

File

src/Entity/Form/GroupContentForm.php, line 143

Class

GroupContentForm
Form controller for the group content edit forms.

Namespace

Drupal\group\Entity\Form

Code

public function back(array &$form, FormStateInterface $form_state) {
  $store = $this->privateTempStoreFactory
    ->get($form_state
    ->get('group_wizard_id'));
  $store_id = $form_state
    ->get('store_id');
  $store
    ->set("{$store_id}:step", 1);

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