You are here

public function Entity::isDefaultRevision in Entity API 7

Checks whether the entity is the default revision.

Return value

bool TRUE if it is the default revision, FALSE otherwise.

Overrides EntityInterface::isDefaultRevision

See also

entity_revision_is_default()

File

includes/entity.inc, line 391
Provides a base class for entities.

Class

Entity
A common class for entities.

Code

public function isDefaultRevision() {
  if (!empty($this->entityInfo['entity keys']['revision'])) {
    $key = !empty($this->entityInfo['entity keys']['default revision']) ? $this->entityInfo['entity keys']['default revision'] : 'default_revision';
    return !empty($this->{$key});
  }
  return TRUE;
}