You are here

public function LinkedFieldManager::getDisplaySettings in Linked Field 8

Get Linked Field display settings for a given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being viewed.

string $view_mode: The name of the view mode.

string $field_name: The name of the field.

Return value

array Getting linked field display settings.

Overrides LinkedFieldManagerInterface::getDisplaySettings

Deprecated

No longer used by internal code and not recommended.

File

src/LinkedFieldManager.php, line 112

Class

LinkedFieldManager
Provides helper methods for client related functionalities.

Namespace

Drupal\linked_field

Code

public function getDisplaySettings(EntityInterface $entity, $view_mode, $field_name) {
  $settings = [];
  $entity_display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
  $component = $entity_display
    ->getComponent($field_name);
  if (isset($component['third_party_settings']['linked_field'])) {
    $settings = $component['third_party_settings']['linked_field'];
  }
  return $settings;
}