Commit b93483a3 authored by Youri van Koppen's avatar Youri van Koppen
Browse files

Issue #3160120 by MegaChriz, andypost: Fixed unexpected error when creating a...

Issue #3160120 by MegaChriz, andypost: Fixed unexpected error when creating a new registration type.
parent ca807c02
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -89,12 +89,17 @@ class RegistrationTypeForm extends EntityForm {
    $registration_type = $this->getEntity();
    $status = $registration_type->save();

    $message = ($status == SAVED_UPDATED) ? '%label registration type was updated.' : '%label registration type was added.';
    $url = $registration_type->toUrl();
    $t_args = ['%label' => $registration_type->label(), 'link' => Link::fromTextAndUrl(t('Edit'), $url)];
    $t_args = ['%label' => $registration_type->id()];
    if ($status == SAVED_NEW) {
      $message = $this->t('%label registration type was added.', $t_args);
    }
    else {
      $message = $this->t('%label registration type was updated.', $t_args);
    }
    $context = $t_args + ['link' => $registration_type->toLink($this->t('Edit'), 'edit-form')->toString()];

    $this->messenger()->addMessage($this->t($message, $t_args));
    $this->logger('rng')->notice($message, $t_args);
    $this->messenger()->addMessage($message);
    $this->logger('rng')->notice($message->getUntranslatedString(), $context);

    $form_state->setRedirect('rng.registration_type.overview');
  }