Get a list of Field API fields attached to an entity

Public

</> CopyGet raw version
php
  1. $instances = field_info_instances('entity_type', 'bundle');
  2.  
  3. // Build list of options.
  4. $options = array();
  5. foreach ($instances as $field_name => $info) {
  6. $options[$field_name] = $info['label'];
  7. }
  8. // Sort in alphabetical order
  9. asort($options);