You are here

public function EventOperation::evaluate in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Condition/EventOperation.php \Drupal\rng\Plugin\Condition\EventOperation::evaluate()
  2. 8 src/Plugin/Condition/EventOperation.php \Drupal\rng\Plugin\Condition\EventOperation::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/EventOperation.php, line 68

Class

EventOperation
Provides an identity has operation permission on event condition.

Namespace

Drupal\rng\Plugin\Condition

Code

public function evaluate() {
  $operation = 'manage event';

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

  /* @var \Drupal\Core\Entity\EntityInterface $event */
  $event = $this
    ->getContextValue('event');
  return $event
    ->access($operation);
}