function UserRole::summary
Same name in other branches
- 8.9.x core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\UserRole::summary()
- 10 core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\UserRole::summary()
- 11.x core/modules/user/src/Plugin/Condition/UserRole.php \Drupal\user\Plugin\Condition\UserRole::summary()
Overrides ConditionInterface::summary
File
-
core/
modules/ user/ src/ Plugin/ Condition/ UserRole.php, line 55
Class
- UserRole
- Provides a 'User Role' condition.
Namespace
Drupal\user\Plugin\ConditionCode
public function summary() {
// Use the role labels. They will be sanitized below.
$roles = array_intersect_key(user_role_names(), $this->configuration['roles']);
if (count($roles) > 1) {
$roles = implode(', ', $roles);
}
else {
$roles = reset($roles);
}
if (!empty($this->configuration['negate'])) {
return $this->t('The user is not a member of @roles', [
'@roles' => $roles,
]);
}
else {
return $this->t('The user is a member of @roles', [
'@roles' => $roles,
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.