0

How can I find out what entity type an entity is, when all I know is the entity ID?

Or is there a way I could list all the entity types on my website (or even via database)?

  • How did you get the entity ID? – beth Mar 31 '14 at 15:40
0

You can't.

Different entities use the same ID.

E.g. you can have a user with ID 42, and a node with ID 42, and a taxonomy term with ID 42. So just knowing the ID is 42 is not enough to know what type of entity the ID belongs to.

This is why entity_load takes both the entity type and the ID as arguments.

To list all entities use entity_get_info().

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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