public static function EntityconnectFormUtils::alterFormStateInput in Entity connect 8.2
Used to update the form state value.
Form state value is updated for entityreference after adding a new entity.
Parameters
array $input: The user input from form state that we need to change.
string $widget_type: The type of the widget used for reference field.
array $parents: The array of all parents of the field. We used them to change the value to the right level in the array.
mixed $element: The value we need to insert.
1 call to EntityconnectFormUtils::alterFormStateInput()
- EntityconnectFormUtils::returnFormAlter in src/
EntityconnectFormUtils.php - Complete entityreference field on parent form with the target_id value.
File
- src/
EntityconnectFormUtils.php, line 486
Class
- EntityconnectFormUtils
- Contains form alter, callbacks and utility methods for entityconnect.
Namespace
Drupal\entityconnectCode
public static function alterFormStateInput(array &$input, $widget_type, array $parents, $element) {
switch ($widget_type) {
case 'autocomplete':
case 'multiple_selects':
array_push($parents, 'target_id');
break;
case 'textfield':
case 'radios':
case 'checkboxes':
default:
break;
}
EntityconnectNestedArray::setValue($input, $parents, $element);
}