public function EntityReferenceLayoutWidget::settingsForm in Entity Reference with Layout 8
Field instance settings form.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array the form array.
Overrides WidgetBase::settingsForm
File
- src/
Plugin/ Field/ FieldWidget/ EntityReferenceLayoutWidget.php, line 1297
Class
- EntityReferenceLayoutWidget
- Entity Reference with Layout field widget.
Namespace
Drupal\entity_reference_layout\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$entity_type_id = $this
->getFieldSetting('target_type');
$form['preview_view_mode'] = [
'#type' => 'select',
'#title' => $this
->t('Preview view mode'),
'#default_value' => $this
->getSetting('preview_view_mode'),
'#options' => $this->entityDisplayRepository
->getViewModeOptions($entity_type_id),
'#required' => TRUE,
'#description' => $this
->t("View mode for the referenced entity preview on the edit form. Automatically falls back to 'default', if it is not enabled in the referenced entity type displays."),
];
$form['always_show_options_form'] = [
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('always_show_options_form'),
'#title' => $this
->t('Always show layout options form'),
'#description' => $this
->t('Show options for additional classes and background color when adding or editing layouts, even if a layout plugin form exists. The preferred method is to rely on Layout Plugin configuration forms.'),
];
return $form;
}