You are here

public function EntityReferenceDisplayFormatterTrait::settingsSummary in Entity Reference Display 8

File

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

Class

EntityReferenceDisplayFormatterTrait
Plugin trait for the 'entity_reference_display' formatters.

Namespace

Drupal\entity_reference_display\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];

  // Get display mode fields.
  $display_fields = $this
    ->getDisplayFields();

  // Get selected display mode field.
  $display_field = $this
    ->getDisplayField($display_fields);

  // Find field label.
  $field_label = $display_fields[$display_field];

  // Create settings summary.
  $summary[] = $this
    ->t('Rendered by display mode selected in "@field" field.', [
    '@field' => $field_label,
  ]);
  return $summary;
}