public function FieldInfo::prepareInstanceDisplay in Drupal 7
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 modules/
field/ field.info.class.inc - Prepares an instance definition for the current run-time context.
File
- modules/
field/ field.info.class.inc, line 609
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',
'settings' => array(),
'weight' => 0,
);
if (empty($display['type'])) {
$display['type'] = $field_type_info['default_formatter'];
}
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;
}