function EntityConstraintViolationList::filterByFieldAccess

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::filterByFieldAccess()
  2. 10 core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::filterByFieldAccess()
  3. 11.x core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::filterByFieldAccess()

Overrides EntityConstraintViolationListInterface::filterByFieldAccess

File

core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php, line 163

Class

EntityConstraintViolationList
Implements an entity constraint violation list.

Namespace

Drupal\Core\Entity

Code

public function filterByFieldAccess(AccountInterface $account = NULL) {
    $filtered_fields = [];
    foreach ($this->getFieldNames() as $field_name) {
        if (!$this->entity
            ->get($field_name)
            ->access('edit', $account)) {
            $filtered_fields[] = $field_name;
        }
    }
    return $this->filterByFields($filtered_fields);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.