You are here

function entity_embed_field_get_display in Entity Embed 7.3

Our own field-less entity-less version of field_get_display().

Parameters

$formatter_type: A formatter type name.

int $settings: Optional array of settings to pass in. If omitted, the formatter's default settings will be returned.

Return value

An array containing 'type' and 'settings'.

In our version of field_get_display() we don't care at all about the field or the entity/bundle that it is attached to. All we want is a display array that will help us hack our way through hook_field_formatter_view() and hook_field_formatter_settings_form(). This mainly means making sure the 'settings' and 'type' elements are there and populated appropriately.

Luckily this can be the same regardless of formatter/module, so we don't need to hard-code module support or invoke any hooks.

1 call to entity_embed_field_get_display()
entity_embed_field_info_instance in includes/entity_embed.display.inc
Our own field-less entity-less version of field_info_instance().

File

includes/entity_embed.display.inc, line 397
Display functions.

Code

function entity_embed_field_get_display($formatter_type, $settings = array()) {

  // If settings is empty, we need to get defaults.
  if (empty($settings)) {
    $formatter_info = field_info_formatter_types($formatter_type);
    if (!empty($formatter_info['settings'])) {
      $settings = $formatter_info['settings'];
    }
  }
  return array(
    'type' => $formatter_type,
    'settings' => $settings,
  );
}