You are here

public function EntityDrupalWrapper::type in Entity API 7

Overridden.

Overrides EntityMetadataWrapper::type

1 call to EntityDrupalWrapper::type()
EntityDrupalWrapper::view in includes/entity.wrapper.inc
Returns the entity prepared for rendering.

File

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

Class

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

Code

public function type() {

  // In case of a generic entity wrapper, load the data first to determine
  // the type of the concrete entity.
  if ($this
    ->dataAvailable() && $this->info['type'] == 'entity') {
    try {
      $this
        ->value(array(
        'identifier' => TRUE,
      ));
    } catch (EntityMetadataWrapperException $e) {

      // If loading data fails, we cannot determine the concrete entity type.
    }
  }
  return $this->type;
}