1 field.info.inc field_formatter_settings_get_instance_display_settings($entity_type, $field_name, $bundle, $view_mode)

Get the formatter settings for a field instance and view mode.

@since 1.13.0

Parameters

string $field_name:

string $display:

string $bundle:

string $view_mode:

Return value

array:

Related topics

File

core/modules/field/field.info.inc, line 603
Field Info API, providing information about available fields and field types.

Code

function field_formatter_settings_get_instance_display_settings($entity_type, $field_name, $bundle, $view_mode) {
  // There is no bundle for this entity type so the bundle name is the
  // entity_type name.
  if (empty($bundle)) {
    $bundle = $entity_type;
  }

  // Fetch the instance settings and default display settings.
  $info = field_info_instance($entity_type, $field_name, $bundle);
  $defaults = $info['display']['default']['settings'];

  if (isset($info['display'][$view_mode]['settings'])) {
    return $info['display'][$view_mode]['settings'] + $defaults;
  }
  else {
    return $defaults;
  }
}