You are here

public function EventOperation::summary 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::summary()
  2. 8 src/Plugin/Condition/EventOperation.php \Drupal\rng\Plugin\Condition\EventOperation::summary()

Provides a human readable summary of the condition's configuration.

Overrides ConditionInterface::summary

File

src/Plugin/Condition/EventOperation.php, line 51

Class

EventOperation
Provides an identity has operation permission on event condition.

Namespace

Drupal\rng\Plugin\Condition

Code

public function summary() {
  $operations = [];
  foreach ($this->configuration['operations'] as $operation => $granted) {
    if ($granted) {
      $operations[] = $this
        ->t("%operation", [
        '%operation' => $operation,
      ]);
    }
  }
  return $this
    ->t(!$this
    ->isNegated() ? 'Logged-in user has access to operations on event: @operations' : 'Logged-in user does not have access to operations on event: @operations', [
    '@operations' => count($operations) > 1 ? implode($this
      ->t(' and '), $operations) : reset($operations),
  ]);
}