How do you get the display settings of a field on a particular content type/display I'm looking to preprocess a field.

The field type I'm wanting to preprocess is an entity reference field.

I need to know what view mode has been selected on the display settings for this field (see screenshot below).



This information is not made available in the $variables variable passed into preprocess_field.

So how can I get this load this information? I have tried looking for some Drupal-specific functions that would return these settings but haven't found anything that works.

Many thanks.
You're looking for field_info_instance()


  Returns an array of instance data for a specific field and bundle


Example usage:

$info = field_info_instance('node', 'field_foo', 'article');
$display_settings = $info['display'];


$display_settings will be an array of display settings keyed by the view modes that are customisable for that content type and bundle.