You are here

public function EntityCollector::submitRemove in Relation 8

Same name and namespace in other branches
  1. 8.2 relation_entity_collector/src/Form/EntityCollector.php \Drupal\relation_entity_collector\Form\EntityCollector::submitRemove()

Submit handler for the remove button.

File

relation_entity_collector/src/Form/EntityCollector.php, line 292
Contains \Drupal\relation_entity_collector\Form\EntityCollector.

Class

EntityCollector
Provides a entity collector form.

Namespace

Drupal\relation_entity_collector\Form

Code

public function submitRemove(array &$form, FormStateInterface $form_state) {
  $entity_key = $form_state['triggering_element']['#entity_key']['entity_key'];
  foreach ($_SESSION['relation_entity_keys'] as $key => $entity) {
    if ($entity['entity_key'] == $entity_key) {
      unset($_SESSION['relation_entity_keys'][$key]);
      $form_state['rebuild'] = TRUE;
      return;
    }
  }
}