public function SubgroupFormStep1::cancel in Subgroup (Graph) 1.0.x
Cancels the group creation by emptying 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.
Overrides GroupForm::cancel
See also
\Drupal\ggroup\Controller\SubgroupWizardController::add()
File
- src/
Form/ SubgroupFormStep1.php, line 71
Class
- SubgroupFormStep1
- Provides a creating a group without it being saved yet.
Namespace
Drupal\ggroup\FormCode
public function cancel(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\group\Entity\GroupInterface $group */
$group = $form_state
->get('group');
$storage_id = $form_state
->get('storage_id');
$store = $this->privateTempStoreFactory
->get('ggroup_add_temp');
$store
->delete("{$storage_id}:group");
// Redirect to the group page if no destination was set in the URL.
$form_state
->setRedirect('entity.group.canonical', [
'group' => $group
->id(),
]);
}