public function UserRole::summary in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Condition/UserRole.php \Drupal\rng\Plugin\Condition\UserRole::summary()
- 8 src/Plugin/Condition/UserRole.php \Drupal\rng\Plugin\Condition\UserRole::summary()
Provides a human readable summary of the condition's configuration.
Overrides UserRole::summary
File
- src/
Plugin/ Condition/ UserRole.php, line 42
Class
- UserRole
- Provides a user role condition where all roles are matched.
Namespace
Drupal\rng\Plugin\ConditionCode
public function summary() {
// Ensure roles in configuration are still existing or valid roles.
$roles = array_intersect_key($this
->getRoles(), $this->configuration['roles']);
if (!count($roles)) {
return $this
->t('Any registered user');
}
return $this
->t(empty($this->configuration['negate']) ? 'User is a member of @roles' : 'User is not a member of @roles', [
'@roles' => count($roles) > 1 ? implode(' and ', $roles) : reset($roles),
]);
}