protected function Entity::validateEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::validateEntity()
- 9 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::validateEntity()
Validates an individual entity against class access settings.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity.
Return value
bool True if validated.
3 calls to Entity::validateEntity()
- Entity::validateArgument in core/
modules/ views/ src/ Plugin/ views/ argument_validator/ Entity.php - TermName::validateArgument in core/
modules/ taxonomy/ src/ Plugin/ views/ argument_validator/ TermName.php - User::validateEntity in core/
modules/ user/ src/ Plugin/ views/ argument_validator/ User.php - Validates an individual entity against class access settings.
1 method overrides Entity::validateEntity()
- User::validateEntity in core/
modules/ user/ src/ Plugin/ views/ argument_validator/ User.php - Validates an individual entity against class access settings.
File
- core/
modules/ views/ src/ Plugin/ views/ argument_validator/ Entity.php, line 217
Class
- Entity
- Defines an argument validator plugin for each entity type.
Namespace
Drupal\views\Plugin\views\argument_validatorCode
protected function validateEntity(EntityInterface $entity) {
// If access restricted by entity operation.
if ($this->options['access'] && !$entity
->access($this->options['operation'])) {
return FALSE;
}
// If restricted by bundle.
$bundles = $this->options['bundles'];
if (!empty($bundles) && empty($bundles[$entity
->bundle()])) {
return FALSE;
}
return TRUE;
}