You are here

public function EmailConfirmation::setResponseUrl in Email confirmer 8

Set a URL to go on confirmation response.

Parameters

\Drupal\Core\Url $url: The URL to go.

string $operation: One of 'confirm', 'cancel' or 'error'. Empty to set for all operations.

Return value

\Drupal\email_confirmer\EmailConfirmationInterface The called email confirmation entity.

Overrides EmailConfirmationInterface::setResponseUrl

File

src/Entity/EmailConfirmation.php, line 473

Class

EmailConfirmation
Defines the email confirmation entity class.

Namespace

Drupal\email_confirmer\Entity

Code

public function setResponseUrl(Url $url, $operation = NULL) {
  $operations = $operation ? [
    $operation,
  ] : [
    'confirm',
    'cancel',
    'error',
  ];
  foreach ($operations as $operation) {
    $this
      ->get($operation . '_url')
      ->setValue($url
      ->toUriString());
  }
  return $this;
}