1 field.info.inc | _field_info_prepare_instance_display($field, $display) |
Adapts display specifications to the current run-time context.
Parameters
$field: The field structure for the instance.
$display: Display specifications as found in $instance['display']['some_view_mode'].
Related topics
File
- core/
modules/ field/ field.info.inc, line 368 - Field Info API, providing information about available fields and field types.
Code
function _field_info_prepare_instance_display($field, $display) {
$field_type = field_info_field_types($field['type']);
// Fill in default values.
$display += array(
'label' => 'hidden',
'type' => $field_type['default_formatter'],
'settings' => array(),
'weight' => 0,
);
if ($display['type'] != 'hidden') {
$formatter_type = field_info_formatter_types($display['type']);
// Fallback to default formatter if formatter type is not available.
if (!$formatter_type) {
$display['type'] = $field_type['default_formatter'];
$formatter_type = field_info_formatter_types($display['type']);
}
$display['module'] = $formatter_type['module'];
// Fill in default settings for the formatter.
$display['settings'] += field_info_formatter_settings($display['type']);
}
return $display;
}