function entity_has_status in Entity API 7
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
bool TRUE if the entity has the status, FALSE otherwise.
7 calls to entity_has_status()
- EntityAPIControllerExportable::delete in includes/
entity.controller.inc - Overridden to care about reverted entities.
- EntityAPIControllerExportable::invoke in includes/
entity.controller.inc - Overridden to care about reverted bundle entities and to skip Rules.
- EntityAPIControllerExportable::save in includes/
entity.controller.inc - Overridden to care exportables that are overridden.
- EntityAPITestCase::testExportableHooks in ./
entity.test - Make sure insert() and update() hooks for exportables are invoked.
- EntityAPITestCase::testExportables in ./
entity.test - Test loading entities defined in code.
File
- ./
entity.module, line 760
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;
}