public EntityConstraintViolationList::filterByFieldAccess(AccountInterface $account = NULL)
Filters this violation list to apply for accessible fields only.
Violations for inaccessible fields are removed so the returned object just has the remaining violations.
Parameters
\Drupal\Core\Session\AccountInterface $account: (optional) The user for which to check access, or NULL to check access for the current user. Defaults to NULL.
Return value
$this
Overrides EntityConstraintViolationListInterface::filterByFieldAccess
File
- core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php, line 158
 
Class
- EntityConstraintViolationList
 - Implements an entity constraint violation list.
 
Namespace
Drupal\Core\Entity
Code
public function filterByFieldAccess(AccountInterface $account = NULL) {
  $filtered_fields = array();
  foreach ($this->getFieldNames() as $field_name) {
    if (!$this->entity->get($field_name)->access('edit', $account)) {
      $filtered_fields[] = $field_name;
    }
  }
  return $this->filterByFields($filtered_fields);
}
Please login to continue.