You are here

public function SubgroupFormStep2::back in Subgroup (Graph) 1.0.x

Goes back to step 1 of subgroup creation.

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 GroupContentForm::back

See also

\Drupal\ggroup\Controller\SubgroupWizardController::add()

\Drupal\ggroup\Form\SubgroupFormStep1

File

src/Form/SubgroupFormStep2.php, line 73

Class

SubgroupFormStep2
Provides a form creating a subgroup.

Namespace

Drupal\ggroup\Form

Code

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

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