You are here

public function EntityDrupalWrapper::entityAccess in Entity API 7

Checks whether the operation $op is allowed on the entity.

See also

entity_access()

1 call to EntityDrupalWrapper::entityAccess()
EntityDrupalWrapper::access in includes/entity.wrapper.inc
Note that this method checks property access, but can be used for checking entity access *only* if the wrapper is not a property (i.e. has no parent wrapper). To be safe, better use EntityDrupalWrapper::entityAccess() for checking entity access.

File

includes/entity.wrapper.inc, line 868
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityDrupalWrapper
Provides a wrapper for entities registrered in hook_entity_info().

Code

public function entityAccess($op, $account = NULL) {
  $entity = $this
    ->dataAvailable() ? $this
    ->value() : NULL;

  // The value() method could return FALSE on entities such as user 0, so we
  // need to use NULL instead to conform to the expectations of
  // entity_access().
  if ($entity === FALSE) {
    $entity = NULL;
  }
  return entity_access($op, $this->type, $entity, $account);
}