You are here

function field_extra_fields_get_display in Drupal 7

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()
taxonomy_term_build_content in modules/taxonomy/taxonomy.module
Builds a structured array representing the term's content.
_field_extra_fields_pre_render in modules/field/field.module
Pre-render callback to adjust weights and visibility of non-field elements.

File

modules/field/field.module, line 688
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;
}