function group_content_wizard_cancel in Group 8
Same name and namespace in other branches
- 2.0.x group.module \group_content_wizard_cancel()
Cancels the wizard for group content creation.
See also
\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 634 - 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(),
]);
}