You are here

public function RenderedEntity::settingsForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\RenderedEntity::settingsForm()

Returns a form to configure settings for the plugin.

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 definition for the widget settings.

Overrides FieldWidgetDisplayBase::settingsForm

File

src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php, line 102

Class

RenderedEntity
Displays the fully rendered entity.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $options = [];
  foreach ($this->entityDisplayRepository
    ->getViewModeOptions($this->configuration['entity_type']) as $id => $view_mode_label) {
    $options[$id] = $view_mode_label;
  }
  return [
    'view_mode' => [
      '#type' => 'select',
      '#title' => $this
        ->t('View mode'),
      '#description' => $this
        ->t('Select view mode to be used when rendering entities.'),
      '#default_value' => $this->configuration['view_mode'],
      '#options' => $options,
    ],
  ];
}