You are here

public function EmailConfirmation::getStatus in Email confirmer 8

Returns the most representative current status of the email confirmation.

Possible status values:

  • pending: confirmation is pending response
  • confirmed: the email confirmation was sent and positively responded
  • cancelled: the confirmation process was cancelled; request could be sent or not
  • expired: the confirmation age is over the allowed maximum, regardless of any other status

Note that an expired confirmation could be confirmed as well. Check the confirmed status with the isConfirmed method.

Return value

string The current status.

Overrides EmailConfirmationInterface::getStatus

See also

\Drupal\email_confirmer\EmailConfirmationInterface::isConfirmed

3 calls to EmailConfirmation::getStatus()
EmailConfirmation::cancel in src/Entity/EmailConfirmation.php
Cancel the email confirmation.
EmailConfirmation::confirm in src/Entity/EmailConfirmation.php
Process the email confirmation.
EmailConfirmation::sendRequest in src/Entity/EmailConfirmation.php
Sends the email confirmation request.

File

src/Entity/EmailConfirmation.php, line 226

Class

EmailConfirmation
Defines the email confirmation entity class.

Namespace

Drupal\email_confirmer\Entity

Code

public function getStatus() {
  if ($this
    ->isExpired()) {
    $status = 'expired';
  }
  elseif ($this
    ->isCancelled()) {
    $status = 'cancelled';
  }
  elseif ($this
    ->isConfirmed()) {
    $status = 'confirmed';
  }
  else {
    $status = 'pending';
  }
  return $status;
}