function EntityReferenceEntityFormatter::settingsForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::settingsForm()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::settingsForm()
  3. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::settingsForm()

Overrides FormatterBase::settingsForm

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php, line 130

Class

EntityReferenceEntityFormatter
Plugin implementation of the 'entity reference rendered entity' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $elements['view_mode'] = [
        '#type' => 'select',
        '#options' => $this->entityDisplayRepository
            ->getViewModeOptions($this->getFieldSetting('target_type')),
        '#title' => $this->t('View mode'),
        '#default_value' => $this->getSetting('view_mode'),
        '#required' => TRUE,
    ];
    return $elements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.