public function CustomAccess::hasFieldViewAccessForEveryEntity in Field Permissions 8.2
Same name and namespace in other branches
- 8 src/Plugin/FieldPermissionType/CustomAccess.php \Drupal\field_permissions\Plugin\FieldPermissionType\CustomAccess::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/ CustomAccess.php, line 58
Class
- CustomAccess
- Defines custom access for fields.
Namespace
Drupal\field_permissions\Plugin\FieldPermissionTypeCode
public function hasFieldViewAccessForEveryEntity(AccountInterface $account) {
$field_name = $this->fieldStorage
->getName();
return $account
->hasPermission('view ' . $field_name);
}