public function EntityConstraintViolationList::filterByFieldAccess
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\EntityCode
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); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityConstraintViolationList.php/function/EntityConstraintViolationList::filterByFieldAccess/8.1.x