How do you return an entity property of 'type' => 'struct' I am using Drupal 7.x and have a created a custom entity. I am using the Entity API module to extend EntityDefaultMetadataController and override public function entityPropertyInfo() to add properties for displaying when my entity is viewed.  

More information on  hook_property_entity_info: 

http://www.drupalcontrib.org/api/drupal/contributions!entity!entity.api.php/function/hook_entity_property_info/7

I understand how to return different types of properties such as 'text', 'int', 'list', 'entity', and so on, using callbacks.  However, I have not been able to successfully return a type of 'struct'.  My field is always empty when I try to display it.

Example code:

  $info['properties']['my-structure_property'] = array(
  'label' =&gt; t('My Structure Property'),  
  'type' =&gt; 'struct',
  'getter callback' =&gt; ?  // What should this return?
  'property info' =&gt; array(
    'sub_field1' =&gt; array(
      'type' =&gt; 'text', 
      'label' =&gt; t('Subfield 1'), 
      'getter callback' =&gt; 'entity_metadata_sub_field1_property_get', // Returns a text field
    ), 
    'sub_field2' =&gt; array(
      'type' =&gt; 'entity', 
      'label' =&gt; t('Subfield 1'), 
      'getter callback' =&gt; 'entity_metadata_sub_field2_property_get', // Returns an entity
    ), 
  ),
); 


What should I be returning in my callback?  I have tried returning an object, an array...?
Based on entity_metadata_node_entity_property_info_alter() and entity_property_text_formatted_info(), I suppose the getter callback should be the most generic callback the entity API offers: entity_property_verbatim_get. 

This should allow you to access the properties as: $custom_entity-&gt;structure_property-&gt;sub_field1