Skip to content

Commit

Permalink
[#12] Retrieve cancellation form also when not using tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Nov 13, 2023
1 parent 730ef29 commit 094599d
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions modules/civiremote_event/src/Form/RegistrationCancelForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,27 @@ public function __construct(CiviMRF $cmrf) {
$routeMatch = RouteMatch::createFromRequest($this->getRequest());
$this->event = $routeMatch->getParameter('event');
$this->remote_token = $routeMatch->getRawParameter('event_token');
// Retrieve event using the remote token, overwriting the event object.
if (!empty($this->remote_token)) {
try {
$form = $this->cmrf->getForm(
(isset($this->event) ? $this->event->id : NULL),
NULL,
$this->remote_token,
'cancel'
);
$this->fields = $form['values'];
$this->messages = isset($form['status_messages']) ? $form['status_messages'] : [];
try {
$form = $this->cmrf->getForm(
(isset($this->event) ? $this->event->id : NULL),
NULL,
$this->remote_token,
'cancel'
);
$this->fields = $form['values'];
$this->messages = isset($form['status_messages']) ? $form['status_messages'] : [];
if (!$this->event) {
$this->event = $this->cmrf->getEvent(
$this->fields['event_id']['value'],
$this->remote_token
);
}
catch (Exception $exception) {
Drupal::messenger()->addMessage(
$exception->getMessage(),
MessengerInterface::TYPE_ERROR
);
}
}
catch (Exception $exception) {
Drupal::messenger()->addMessage(
$exception->getMessage(),
MessengerInterface::TYPE_ERROR
);
}
}

Expand Down

0 comments on commit 094599d

Please sign in to comment.