function field_extra_fields_get_display

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

2 calls to field_extra_fields_get_display()
TermRenderController::buildContent in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/TermRenderController.php
Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
_field_extra_fields_pre_render in drupal/core/modules/field/field.module
Pre-render callback: Adjusts weights and visibility of non-field elements.

File

drupal/core/modules/field/field.module, line 740
Attach custom data fields to Drupal entities.

Code

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;
}