public function FieldInfo::prepareInstanceDisplay

7.x public FieldInfo::prepareInstanceDisplay($display, $field_type)

Adapts display specifications to the current run-time context.


$display: Display specifications as found in $instance['display']['a_view_mode'].

$field_type: The field type.

Return value

The display properties completed for the current runtime context.

1 call to FieldInfo::prepareInstanceDisplay()
FieldInfo::prepareInstance in drupal/modules/field/
Prepares an instance definition for the current run-time context.


drupal/modules/field/, line 593


Provides field and instance definitions for the current runtime environment.


public function prepareInstanceDisplay($display, $field_type) {
  $field_type_info = field_info_field_types($field_type);

  // Fill in default values.
  $display += array(
    'label' => 'above',
    'type' => $field_type_info['default_formatter'],
    'settings' => array(),
    'weight' => 0,
  if ($display['type'] != 'hidden') {
    $formatter_type_info = field_info_formatter_types($display['type']);
    // Fall back to default formatter if formatter type is not available.
    if (!$formatter_type_info) {
      $display['type'] = $field_type_info['default_formatter'];
      $formatter_type_info = field_info_formatter_types($display['type']);
    $display['module'] = $formatter_type_info['module'];
    // Fill in default settings for the formatter.
    $display['settings'] += field_info_formatter_settings($display['type']);

  return $display;