1. drupal
    1. 8
    2. 7
8 – 7 field_view_mode_settings($entity_type, $bundle)

Returns view mode settings in a given bundle.


$entity_type The type of entity; e.g. 'node' or 'user'.

$bundle The bundle name to return view mode settings for.

Return value

An array keyed by view mode, with the following key/value pairs:

  • custom_settings: Boolean specifying whether the view mode uses a dedicated set of display options (TRUE), or the 'default' options (FALSE). Defaults to FALSE.

Related topics

▾ 6 functions call field_view_mode_settings()

field_extra_fields_get_display in modules/field/field.module
Returns the display settings to use for pseudo-fields in a given view mode.
field_get_display in modules/field/field.module
Returns the display settings to use for an instance in a given view mode.
field_ui_display_overview_form in modules/field_ui/
Menu callback; presents field display settings for a given view mode.
field_ui_display_overview_form_submit in modules/field_ui/
Submit handler for the display overview form.
_field_info_prepare_instance in modules/field/
Prepares an instance definition for the current run-time context.
_field_ui_view_mode_menu_access in modules/field_ui/field_ui.module
Menu access callback for the 'view mode display settings' pages.


modules/field/field.module, line 651

function field_view_mode_settings($entity_type, $bundle) {
  $cache = &drupal_static(__FUNCTION__, array());

  if (!isset($cache[$entity_type][$bundle])) {
    $bundle_settings = field_bundle_settings($entity_type, $bundle);
    $settings = $bundle_settings['view_modes'];
    // Include view modes for which nothing has been stored yet, but whose
    // definition in hook_entity_info() specify they should use custom settings
    // by default.
    $entity_info = entity_get_info($entity_type);
    foreach ($entity_info['view modes'] as $view_mode => $view_mode_info) {
      if (!isset($settings[$view_mode]['custom_settings']) && $view_mode_info['custom settings']) {
        $settings[$view_mode]['custom_settings'] = TRUE;
    $cache[$entity_type][$bundle] = $settings;

  return $cache[$entity_type][$bundle];