field_extra_fields_get_display

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 field_extra_fields_get_display($entity_type, $bundle, $view_mode)

Returns the display settings to use for pseudo-fields in a given view mode.

Parameters

$entity_type The type of $entity; e.g., 'node' or 'user'.

$bundle The bundle name.

$view_mode The view mode.

Return value

The display settings to be used when viewing the bundle's pseudo-fields.

Related topics

Code

modules/field/field.module, line 718

<?php
function field_extra_fields_get_display($entity_type, $bundle, $view_mode) {
  // Check whether the view mode uses custom display settings or the 'default'
  // mode.
  $view_mode_settings = field_view_mode_settings($entity_type, $bundle);
  $actual_mode = (!empty($view_mode_settings[$view_mode]['custom_settings'])) ? $view_mode : 'default';
  $extra_fields = field_info_extra_fields($entity_type, $bundle, 'display');

  $displays = array();
  foreach ($extra_fields as $name => $value) {
    $displays[$name] = $extra_fields[$name]['display'][$actual_mode];
  }

  // Let modules alter the display settings.
  $context = array(
    'entity_type' => $entity_type, 
    'bundle' => $bundle, 
    'view_mode' => $view_mode,
  );
  drupal_alter('field_extra_fields_display', $displays, $context);

  return $displays;
}
?>