When adding Pseudo fields with hook_field_extra_fields these do not get added to the table, The reason for this is because the formatter is only displaying fields from field_info_instances.

 * Implements hook_field_extra_fields().
function mymodule_field_extra_fields() {
  $extra = array();

  $extra['field_collection_item']['field_invoice_line_item'] = array(
    'display' => array(
      'invoice_line_item_total' => array(
        'label' => t('Total'),
        'description' => t('Line Item Subtotal'),
        'weight' => 0,

  return $extra;

 * Implements hook_entity_view().
function mymodule_entity_view($entity, $type, $view_mode, $langcode) {
  if($type == 'field_collection_item' && $entity->field_name == 'field_invoice_line_item') {
    $entity->content['invoice_line_item_total'] = array(
      '#title' => t('Total'),
      '#markup' => '50.00',
      '#weight' => 5,

Proposed resolution

Allow Psudeo fields to be displayed by not relying on the fields themselves, The patch below uses element_children and the #title attribute to create the fields and header arrays, which fixes the problem I was having.

Members fund testing for the Drupal project. Drupal Association Learn more


paulmartin84 created an issue. See original summary.

paulmartin84’s picture

gusantor’s picture

Hello, I've similar issue

when I choose "Table of field collection items" as formatter for the field collection item that contains the extra field, the extra field disappear from display

I've applied your path with

patch -p1 < field_collection_table-support_for_psuedo_fields-707484-2.patch

but recive errror:

Hunk #1 FAILED at 37.
1 out of 1 hunk FAILED -- saving rejects to file field_collection_table.module.rej

anyway, I manually did the changes, it works !


gusantor’s picture

sorry but patch at #2 couses a 500 error in another place (content type)

so I've changed it a bit, instead of change the foreach loop, I've added another one following the original, lookig for extra fields

and it works :)

      $extra_fields = field_info_extra_fields('field_collection_item', $field['field_name'], 'display');
        foreach($extra_fields as $kfn=>$field_name) {
          $field_names[] = $kfn;#$field_name;
          $header[] = isset($field_name['label']) ? $field_name['label'] : '';