public static function JsonapiResourceConfigForm::getEnhancerSettings in JSON:API Extras 8
Same name and namespace in other branches
- 8.3 src/Form/JsonapiResourceConfigForm.php \Drupal\jsonapi_extras\Form\JsonapiResourceConfigForm::getEnhancerSettings()
- 8.2 src/Form/JsonapiResourceConfigForm.php \Drupal\jsonapi_extras\Form\JsonapiResourceConfigForm::getEnhancerSettings()
AJAX callback to get the form settings for the enhancer for a field.
Parameters
array $form: The reference to the form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
mixed The specific form sub-tree in the form.
File
- src/
Form/ JsonapiResourceConfigForm.php, line 446
Class
- JsonapiResourceConfigForm
- Base form for jsonapi_resource_config.
Namespace
Drupal\jsonapi_extras\FormCode
public static function getEnhancerSettings(array &$form, FormStateInterface $form_state) {
// Find what is the field name that triggered the AJAX request.
$user_input = $form_state
->getUserInput();
$parts = explode('[', $user_input['_triggering_element_name']);
$field_name = rtrim($parts[1], ']');
// Now return the sub-tree for the settings on the enhancer plugin.
return $form['bundle_wrapper']['fields_wrapper']['overrides']['fields']['resourceFields'][$field_name]['enhancer']['settings'];
}