function entity_has_status

7.x entity.module entity_has_status($entity_type, $entity, $status)

Checks if a given entity has a certain exportable status.

Parameters

$entity_type: The type of the entity.

$entity: The entity to check the status on.

$status: The constant status like ENTITY_CUSTOM, ENTITY_IN_CODE, ENTITY_OVERRIDDEN or ENTITY_FIXED.

Return value

TRUE if the entity has the status, FALSE otherwise.

7 calls to entity_has_status()
EntityAPIControllerExportable::delete in entity/includes/entity.controller.inc
Overridden to care about reverted entities.
EntityAPIControllerExportable::invoke in entity/includes/entity.controller.inc
Overridden to care about reverted bundle entities and to skip Rules.
EntityAPIControllerExportable::save in entity/includes/entity.controller.inc
Overridden to care exportables that are overridden.
EntityAPITestCase::testExportableHooks in entity/entity.test
Make sure insert() and update() hooks for exportables are invoked.
EntityAPITestCase::testExportables in entity/entity.test
Test loading entities defined in code.

... See full list

File

entity/entity.module, line 745
Module file for the entity API.

Code

function entity_has_status($entity_type, $entity, $status) {
  $info = entity_get_info($entity_type);
  $status_key = empty($info['entity keys']['status']) ? 'status' : $info['entity keys']['status'];
  return isset($entity->{$status_key}) && ($entity->{$status_key} & $status) == $status;
}