return $form;
} /**
* Render API callback: builds the formatter settings elements.
*/
public function formatterSettingsProcessCallback(array &
$element, FormStateInterface
$form_state, array &
$complete_form) { if ($formatter =
$this->
getFormatter($element['#parents'
],
$form_state)) { $element['settings_wrapper'
]['settings'
] =
$formatter->
settingsForm($complete_form,
$form_state);
$element['settings_wrapper'
]['settings'
]['#parents'
] =
array_merge($element['#parents'
],
['settings'
]);
$element['settings_wrapper'
]['third_party_settings'
] =
$this->
thirdPartySettingsForm($formatter,
$this->
getFieldDefinition(),
$complete_form,
$form_state);
$element['settings_wrapper'
]['third_party_settings'
]['#parents'
] =
array_merge($element['#parents'
],
['third_party_settings'
]);
FormHelper::
rewriteStatesSelector($element['settings_wrapper'
], "fields[
$this->fieldName][settings_edit_form]", 'settings[formatter]'
);
// Store the array parents for our element so that we can retrieve the
// formatter settings in our AJAX callback.
$form_state->
set('field_block_array_parents',
$element['#array_parents'
]);
} return $element;
} /**
* Adds the formatter third party settings forms.
*
* @param \Drupal\Core\Field\FormatterInterface $plugin
* The formatter.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition.
* @param array $form
* The (entire) configuration form array.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return array
* The formatter third party settings form.
*/