You are here

public function ConfigEntityRevisionsEditFormTrait::cancel in Config Entity Revisions 8.2

Form submission handler for the 'cancel' action.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

src/ConfigEntityRevisionsEditFormTrait.php, line 37

Class

ConfigEntityRevisionsEditFormTrait
Trait ConfigEntityRevisionsEditFormTrait.

Namespace

Drupal\config_entity_revisions

Code

public function cancel(array $form, FormStateInterface $form_state) {

  // Remove this view from cache so edits will be lost.
  parent::cancel($form, $form_state);
  $entity = $this
    ->getEntity();
  if ($entity instanceof ConfigEntityRevisionsConfigEntityContainerInterface) {
    $revId = $entity
      ->revisionedEntity()
      ->get('loadedRevisionId');
    $cacheId = $revId ? $entity
      ->id() . '-' . $revId : $entity
      ->id();
    $this->tempStore
      ->delete($cacheId);
  }
}