2 deleted 1 character in body
source | link

I can use

$entity = entity_metadata_wrapper('node', 1);
$entity->getBundle(); 

to get the node type of an entity. However, entity-wrappers can wrap other types of entities, fe.exg. users. When calling getBundle() on a user entity, 'user' is returned. What should I call to return the type of entity (should return 'node' in the example above)? I can see when I print_r($entity) that $entity->type is a protected field of the wrapper object.

I can use

$entity = entity_metadata_wrapper('node', 1);
$entity->getBundle(); 

to get the node type of an entity. However, entity-wrappers can wrap other types of entities, f.ex. users. When calling getBundle() on a user entity, 'user' is returned. What should I call to return the type of entity (should return 'node' in the example above)? I can see when I print_r($entity) that $entity->type is a protected field of the wrapper object.

I can use

$entity = entity_metadata_wrapper('node', 1);
$entity->getBundle(); 

to get the node type of an entity. However, entity-wrappers can wrap other types of entities, e.g. users. When calling getBundle() on a user entity, 'user' is returned. What should I call to return the type of entity (should return 'node' in the example above)? I can see when I print_r($entity) that $entity->type is a protected field of the wrapper object.

1
source | link

How to get entity type from entity_metadata_wrapper

I can use

$entity = entity_metadata_wrapper('node', 1);
$entity->getBundle(); 

to get the node type of an entity. However, entity-wrappers can wrap other types of entities, f.ex. users. When calling getBundle() on a user entity, 'user' is returned. What should I call to return the type of entity (should return 'node' in the example above)? I can see when I print_r($entity) that $entity->type is a protected field of the wrapper object.