You are here

function group_content_wizard_cancel in Group 2.0.x

Same name and namespace in other branches
  1. 8 group.module \group_content_wizard_cancel()

Cancels the wizard for group content creation.

See also

group_form_alter()

\Drupal\group\Entity\Controller\GroupContentController::createForm()

1 string reference to 'group_content_wizard_cancel'
group_form_alter in ./group.module
Implements hook_form_alter().

File

./group.module, line 624
Allows you to group users, content and other entities.

Code

function group_content_wizard_cancel($form, FormStateInterface $form_state) {
  $store = \Drupal::service('tempstore.private')
    ->get($form_state
    ->get('group_wizard_id'));
  $store_id = $form_state
    ->get('store_id');
  $store
    ->delete("{$store_id}:entity");
  $store
    ->delete("{$store_id}:step");

  /** @var \Drupal\group\Entity\GroupInterface $group */
  $group = $form_state
    ->get('group');

  // Redirect to the group page if no destination was set in the URL.
  $form_state
    ->setRedirect('entity.group.canonical', [
    'group' => $group
      ->id(),
  ]);
}