function entity_revision_is_default

cis7 entity.module entity_revision_is_default($entity_type, $entity)
cle7 entity.module entity_revision_is_default($entity_type, $entity)
elmsmedia7 entity.module entity_revision_is_default($entity_type, $entity)
icor7 entity.module entity_revision_is_default($entity_type, $entity)
meedjum_blog7 entity.module entity_revision_is_default($entity_type, $entity)
mooc7 entity.module entity_revision_is_default($entity_type, $entity)

Checks whether the given entity is the default revision.

Note that newly created entities will always be created in default revision, thus TRUE is returned for not yet saved entities.


$entity_type: The type of the entity.

$entity: The entity object to check.

Return value

boolean A boolean indicating whether the entity is in default revision is returned. If the entity is not revisionable or is new, TRUE is returned.

See also


3 calls to entity_revision_is_default()
EntityAPIController::deleteRevision in sites/all/modules/ulmus/entity/includes/
Implements EntityAPIControllerRevisionableInterface::deleteRevision().
FieldCollectionItemEntity::setHostEntity in sites/all/modules/ulmus/field_collection/field_collection.module
Sets the host entity. Only possible during creation of a item.
field_collection_field_update in sites/all/modules/ulmus/field_collection/field_collection.module
Implements hook_field_update().


sites/all/modules/ulmus/entity/entity.module, line 401
Module file for the entity API.


function entity_revision_is_default($entity_type, $entity) {
  $info = entity_get_info($entity_type);
  if (empty($info['entity keys']['revision'])) {
    return TRUE;
  // Newly created entities will always be created in default revision.
  if (!empty($entity->is_new) || empty($entity->{$info['entity keys']['id']})) {
    return TRUE;
  if (in_array('EntityAPIControllerRevisionableInterface', class_implements($info['controller class']))) {
    $key = !empty($info['entity keys']['default revision']) ? $info['entity keys']['default revision'] : 'default_revision';
    return !empty($entity->$key);
  else {
    // Else, just load the default entity and compare the ID. Usually, the
    // entity should be already statically cached anyway.
    $default = entity_load_single($entity_type, $entity->{$info['entity keys']['id']});
    return $default->{$info['entity keys']['revision']} == $entity->{$info['entity keys']['revision']};



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.