You are here

public function EntityReferenceMultipleFormatter::settingsForm in Entity reference multiple display 8

Same name and namespace in other branches
  1. 8.x src/Plugin/Field/FieldFormatter/EntityReferenceMultipleFormatter.php \Drupal\entityreference_multiple\Plugin\Field\FieldFormatter\EntityReferenceMultipleFormatter::settingsForm()

Returns a form to configure settings for the formatter.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form elements for the formatter settings.

Overrides EntityReferenceEntityFormatter::settingsForm

File

src/Plugin/Field/FieldFormatter/EntityReferenceMultipleFormatter.php, line 25

Class

EntityReferenceMultipleFormatter
Plugin implementation of the 'entityreference_entity_multiple_view' formatter.

Namespace

Drupal\entityreference_multiple\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $elements['view_mode'] = [
    '#type' => 'textfield',
    '#title' => t('View mode list'),
    '#description' => t('Enter comma separated view modes. Each one represents one entity.<br />
        The last view mode listed here will be used for any remaining entities.<br />
        Example: <pre>featured,teaser,teaser,teaser,default</pre>'),
    '#default_value' => $this
      ->getSetting('view_mode'),
    '#required' => TRUE,
  ];
  return $elements;
}