I wonder if there is a good, and easy way to get all fields of an entity.

I have a taxonomy vocabulary. Its terms have a special field I want to make list in a select box in one of my modules, so that users can select a special value of the term. Therefore, I need a way to list the possible fields for this term.

3 Answers 3


The function you are looking for is field_info_instances().

Retrieves information about field instances.


Drupal 7

You may try:

  $info = entity_get_property_info($entity_type);
  $info += array(
    'properties' => array(),
    'bundles' => array(),
  // Add all bundle properties.
  foreach ($info['bundles'] as $bundle => $bundle_info) {
    $bundle_info += array('properties' => array());
    $info['properties'] += $bundle_info['properties'];

Or if you have Entity module installed, then try:


Drush commands (one of these):

drush eval "var_dump(entity_get_all_property_info('node'));"
drush eval "print var_export(array_keys(entity_get_all_property_info('node')));"

Can also use the function : field_info_field_map()

In place of returning entities going down to fields, it starts from field and go down to entities. That second one is fine to see where fields are going, whereas field_info_instances() shows how entities are built.

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.