7.x field.api.php hook_field_extra_fields_display_alter(&$displays, $context)

Alters the display settings of pseudo-fields before an entity is displayed.

This hook is called once per displayed entity. If the result of the hook involves reading from the database, it is highly recommended to statically cache the information.

Parameters

$displays: An array of display settings for the pseudo-fields in the entity, keyed by pseudo-field names.

$context: An associative array containing:

  • entity_type: The entity type; e.g., 'node' or 'user'.
  • bundle: The bundle name.
  • view_mode: The view mode, e.g. 'full', 'teaser'...

Related topics

File

modules/field/field.api.php, line 2430
Hooks provided by the Field module.

Code

function hook_field_extra_fields_display_alter(&$displays, $context) {
  if ($context['entity_type'] == 'taxonomy_term' && $context['view_mode'] == 'full') {
    $displays['description']['visible'] = FALSE;
  }
}

Comments

this don't work for formatter table of field collection items

I'm trying to display extra field for a field collection item (FCI), this FCI is embeded in a node

when I use formater "field collection items" on the display of the node, the extra field appears as expected, it shows up

if I set the display formater of the FCI on the node to "table of field collection items", the extra field won't display

is there any way I can get the extra field displayed when I choose "table of field collection items" as formatter for the FCI on the node display ?

I found out this https://www.drupal.org/node/2672734 which seems to address the issue, but I wont to apply the patch because I dont know if there a "more right" way to achieve this

any thoughts ? ... thanks

EDIT> sorry , this should be posted here https://api.drupal.org/comment/61797#comment-61797