You are here

public function ConfigEntityRevisionsOverviewFormBase::submitForm in Config Entity Revisions 8

Same name and namespace in other branches
  1. 8.2 src/ConfigEntityRevisionsOverviewFormBase.php \Drupal\config_entity_revisions\ConfigEntityRevisionsOverviewFormBase::submitForm()
  2. 1.x src/ConfigEntityRevisionsOverviewFormBase.php \Drupal\config_entity_revisions\ConfigEntityRevisionsOverviewFormBase::submitForm()

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/ConfigEntityRevisionsOverviewFormBase.php, line 445

Class

ConfigEntityRevisionsOverviewFormBase
Controller to make library functions available to various consumers.

Namespace

Drupal\config_entity_revisions

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $input = $form_state
    ->getUserInput();
  $vid_left = $input['radios_left'];
  $vid_right = $input['radios_right'];
  $entity_type = $input['entity_type'];
  $entity_id = $input['entity_id'];

  // Always place the older revision on the left side of the comparison
  // and the newer revision on the right side (however revisions can be
  // compared both ways if we manually change the order of the parameters).
  if ($vid_left > $vid_right) {
    $aux = $vid_left;
    $vid_left = $vid_right;
    $vid_right = $aux;
  }

  // Builds the redirect Url.
  $redirect_url = Url::fromRoute("diff.config_entity_revisions_diff", [
    'config_entity_type' => $entity_type,
    'config_entity_id' => $entity_id,
    'left_revision' => $vid_left,
    'right_revision' => $vid_right,
    'filter' => $this->diffLayoutManager
      ->getDefaultLayout(),
  ]);
  $form_state
    ->setRedirectUrl($redirect_url);
}