You are here

function context_groups_reaction_delete_submit in Context groups 8

Same name and namespace in other branches
  1. 8.2 context_groups.module \context_groups_reaction_delete_submit()

Submit callback on reaction delete.

1 string reference to 'context_groups_reaction_delete_submit'
context_groups_form_context_reaction_delete_confirm_alter in ./context_groups.module
Implements hook_form_FORM_ID_alter().

File

./context_groups.module, line 163
Hooks and helper functions.

Code

function context_groups_reaction_delete_submit(&$form, FormStateInterface $form_state) {
  $context_id = $form_state
    ->get('context_id');
  $context = Context::load($context_id);
  $saved_context_groups = $context
    ->getThirdPartySettings('context_groups');

  // Remove groups from reaction that is deleted.
  foreach ($saved_context_groups as $context_group => $value) {
    $context
      ->unsetThirdPartySetting('context_groups', $context_group);
  }
  $context
    ->save();
}