public function FieldInfo::prepareInstanceDisplay

7.x field.info.class.inc public FieldInfo::prepareInstanceDisplay($display, $field_type)

Adapts display specifications to the current run-time context.

Parameters

$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-7.x/modules/field/field.info.class.inc
Prepares an instance definition for the current run-time context.

File

drupal-7.x/modules/field/field.info.class.inc, line 593

Class

FieldInfo
Provides field and instance definitions for the current runtime environment.

Code

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