You are here

public function MergeTermsConfirm::submitForm in Term Merge 8

Plugin annotation

@SuppressWarnings(camelCase);

Overrides FormInterface::submitForm

File

src/Form/MergeTermsConfirm.php, line 146

Class

MergeTermsConfirm
Term merge confirm form.

Namespace

Drupal\term_merge\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $selectedTerms = $this
    ->loadSelectedTerms();
  $target = $this->tempStoreFactory
    ->get('term_merge')
    ->get('target');
  if (is_string($target)) {
    $this->termMerger
      ->mergeIntoNewTerm($selectedTerms, $target);
    $this
      ->setSuccessfullyMergedMessage(count($selectedTerms), $target);
    $this
      ->redirectToTermMergeForm($form_state);
    return;
  }
  $this->termMerger
    ->mergeIntoTerm($selectedTerms, $target);
  $this
    ->setSuccessfullyMergedMessage(count($selectedTerms), $target
    ->label());
  $this
    ->redirectToTermMergeForm($form_state);
}