Creating a custom field view using theme_field template Folks - I'm trying to create a custom field view with custom content that utilises the standard theme_field template, to display in a node template.

I've tried to call the function programmatically e.g:

  $field_vars = array(
    'title_attributes' =&gt; 'test123',
    'label' =&gt; t('custom field label'),
    'items' =&gt; array('&lt;p&gt;This is a test&lt;/p&gt;'),
    'classes' =&gt; 'test',
    'attributes' =&gt; FALSE
  );
  $my_field = theme('field', $field_vars); 
  print $my_field;


It returns the template, but none of the $field_vars are being used.  Has anyone done something similar?
I'm not really sure what you are trying to do, but if you only like to render a custom array with the field template this should work:

$field = array(
  '#theme' =&gt; 'field',
  '#field_type' =&gt; 'text',
  '#field_name' =&gt; 'temp_field',
  '#entity_type' =&gt; 'node',
  '#bundle' =&gt; null,
  '#items' =&gt; array(
     array(
       'value' =&gt; '',
     )
   ),
   0 =&gt; array(
     '#markup' =&gt; '&lt;p&gt;This is a test&lt;/p&gt;'
   )
);
print theme_field(array(
  'label_hidden' =&gt; false,
  'label' =&gt; t('custom field label'),
  'items' =&gt; array($field),
  'classes' =&gt; 'test',
  'content_attributes' =&gt; '',
  'attributes' =&gt; '',
  'item_attributes' =&gt; ''
));


You can load one of your existing field using field_view_field() to check what data the renderable array contains. For example to load the body field from a node with an id equal to 1000 you could do like this:

$node = node_load(1000);
$field = field_view_field('node', $node, 'body');
print_r($field);