function User::validateEntity
Same name in other branches
- 9 core/modules/user/src/Plugin/views/argument_validator/User.php \Drupal\user\Plugin\views\argument_validator\User::validateEntity()
- 10 core/modules/user/src/Plugin/views/argument_validator/User.php \Drupal\user\Plugin\views\argument_validator\User::validateEntity()
- 11.x core/modules/user/src/Plugin/views/argument_validator/User.php \Drupal\user\Plugin\views\argument_validator\User::validateEntity()
Overrides Entity::validateEntity
1 call to User::validateEntity()
- UserName::validateArgument in core/
modules/ user/ src/ Plugin/ views/ argument_validator/ UserName.php - Performs validation for a given argument.
File
-
core/
modules/ user/ src/ Plugin/ views/ argument_validator/ User.php, line 86
Class
- User
- Validate whether an argument is a valid user.
Namespace
Drupal\user\Plugin\views\argument_validatorCode
protected function validateEntity(EntityInterface $entity) {
/** @var \Drupal\user\UserInterface $entity */
$role_check_success = TRUE;
// See if we're filtering users based on roles.
if (!empty($this->options['restrict_roles']) && !empty($this->options['roles'])) {
$roles = $this->options['roles'];
if (!(bool) array_intersect($entity->getRoles(), $roles)) {
$role_check_success = FALSE;
}
}
return $role_check_success && parent::validateEntity($entity);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.