You are here

private function EntityReferenceDisplayFormatterTrait::getDisplayField in Entity Reference Display 8

Retrieve selected display mode field.

2 calls to EntityReferenceDisplayFormatterTrait::getDisplayField()
EntityReferenceDisplayFormatterTrait::settingsSummary in src/Plugin/Field/FieldFormatter/EntityReferenceDisplayFormatterTrait.php
EntityReferenceDisplayFormatterTrait::viewElements in src/Plugin/Field/FieldFormatter/EntityReferenceDisplayFormatterTrait.php

File

src/Plugin/Field/FieldFormatter/EntityReferenceDisplayFormatterTrait.php, line 129

Class

EntityReferenceDisplayFormatterTrait
Plugin trait for the 'entity_reference_display' formatters.

Namespace

Drupal\entity_reference_display\Plugin\Field\FieldFormatter

Code

private function getDisplayField(array $display_fields) {

  // Get display mode field setting.
  $display_field = $this
    ->getSetting('display_field');

  // Use first field if no setting exists.
  if (empty($display_field)) {
    $display_field = key($display_fields);
  }
  return $display_field;
}