I can use

$entity = entity_metadata_wrapper('node', 1);

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 Answer 1


Hmmm, I seem to have found a way (unsure if this is the 'correct' way...)

$entity = entity_metadata_wrapper('node', 1);
$info = $entity->info();  // entity info as an array
$entity_type = $info['type']; // returns 'node' for node entities

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.