You are here

public function Entity::defaultConfiguration in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/Plugin/DsField/Entity.php \Drupal\ds\Plugin\DsField\Entity::defaultConfiguration()
  2. 8.3 src/Plugin/DsField/Entity.php \Drupal\ds\Plugin\DsField\Entity::defaultConfiguration()

Gets default configuration for this plugin.

Return value

array An associative array with the default configuration.

Overrides DsFieldBase::defaultConfiguration

File

src/Plugin/DsField/Entity.php, line 88

Class

Entity
Renders an entity by a given view mode.

Namespace

Drupal\ds\Plugin\DsField

Code

public function defaultConfiguration() {
  $entity = $this
    ->linkedEntity();
  $view_modes = $this->entityDisplayRepository
    ->getViewModes($entity);
  reset($view_modes);
  $default_view_mode = key($view_modes);
  $configuration = [
    'entity_view_mode' => $default_view_mode,
  ];
  return $configuration;
}