You are here

public function SubgroupFormStep1::saveTemporary in Subgroup (Graph) 1.0.x

Saves a temporary group and continues to step 2 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.

See also

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

\Drupal\ggroup\Form\SubgroupFormStep2

File

src/Form/SubgroupFormStep1.php, line 48

Class

SubgroupFormStep1
Provides a creating a group without it being saved yet.

Namespace

Drupal\ggroup\Form

Code

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

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