Entity Base Type
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Spawned from Drupal Core issue: #1042822.
I routinely need to handle entities and their fields in a generic manner. For some reason an entity object doesn't have a property to describe what kind of entity it actually (i.e.: node, user, comment).
This module is incredibly simple, it adds a property called base_type to a entity in hook_entity_load.
A common scenario is using field_get_items($entity_type, $entity, $field_name, $langcode = NULL) where it needs the $entity_type. If you're handling fields in a generic manner, you won't have access to the entity type.
Scenario problem:
/* ... */
field_get_items('?????', $entity, $field_name);
Example solution with Entity Base Type enabled:
/* ... */
field_get_items($entity->base_type, $entity, $field_name);
Why is the new property called "base_type" and not "entity_type"?
I didn't want to conflict with OG's similar situation where it adds "entity_type" to its objects.
