You are here

protected function Entity::validateEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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:

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 200
Contains \Drupal\views\Plugin\views\argument_validator\Entity.

Class

Entity
Defines a argument validator plugin for each entity type.

Namespace

Drupal\views\Plugin\views\argument_validator

Code

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 (count($bundles) && empty($bundles[$entity
    ->bundle()])) {
    return FALSE;
  }
  return TRUE;
}