public function buildOptionsForm(&
$form, FormStateInterface
$form_state) { parent::
buildOptionsForm($form,
$form_state);
// Get the mapping.
$mapping =
$this->
defineMapping();
// Restrict the list of defaults to the mapping, in case they have changed.
$options =
array_intersect_key($this->options
['mapping'
],
$mapping);
// Get the labels of the fields added to this display.
$field_labels =
$this->displayHandler->
getFieldLabels();
// Provide some default values.
$defaults =
[ '#type' => 'select',
'#required' => FALSE,
'#multiple' => FALSE,
];
// For each mapping, add a select element to the form.
foreach ($options as $key =>
$value) { // If the field is optional, add a 'None' value to the top of the options.