You are here

public function PrivateAccess::hasFieldViewAccessForEveryEntity in Field Permissions 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/FieldPermissionType/PrivateAccess.php \Drupal\field_permissions\Plugin\FieldPermissionType\PrivateAccess::hasFieldViewAccessForEveryEntity()

Determines if the given account may view the field, regardless of entity.

This should only return TRUE if

$this
  ->hasFieldAccess('view', $entity, $account);

returns TRUE for all possible $entity values.

@todo Move this to an interface: either FieldPermissionTypeInterface or a new one.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user to check access for.

Return value

bool The access result.

Overrides Base::hasFieldViewAccessForEveryEntity

File

src/Plugin/FieldPermissionType/PrivateAccess.php, line 49

Class

PrivateAccess
Defines a private field type.

Namespace

Drupal\field_permissions\Plugin\FieldPermissionType

Code

public function hasFieldViewAccessForEveryEntity(AccountInterface $account) {
  return $account
    ->hasPermission('access private fields');
}