You are here

public function IdentityIsRegistrant::evaluate in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Condition/IdentityIsRegistrant.php \Drupal\rng\Plugin\Condition\IdentityIsRegistrant::evaluate()
  2. 3.x src/Plugin/Condition/IdentityIsRegistrant.php \Drupal\rng\Plugin\Condition\IdentityIsRegistrant::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/IdentityIsRegistrant.php, line 49

Class

IdentityIsRegistrant
Provides a identity is registrant condition.

Namespace

Drupal\rng\Plugin\Condition

Code

public function evaluate() {

  /* @var \Drupal\user\UserInterface $user */
  $user = $this
    ->getContextValue('user');

  /* @var \Drupal\rng\RegistrationInterface $registration */
  $registration = $this
    ->getContextValue('registration');

  // Does not support new registrations ('create' operation).
  if (!$registration
    ->isNew()) {
    return $registration
      ->hasIdentity($user);
  }
  return FALSE;
}