entity_reference_autocomplete_add_more
If non-entity custom form require a form element that allows adding entity reference and individual entity need to be added using it's own input field same as "entity_reference_autocomplete" widget with tags=false, this module provides that ability. As "entity_reference_autocomplete" require field storage attached to it, it only works with entity forms. This module is a light weight alternative that can be used for any custom forms. This module is only for developer use.
Features
Allows referencing other entities in a custom form. It provides an entity autocomplete input box and "add more item", "remove" buttons to add multiple reference entities using individual inputs.
Post-Installation
This is for dev use only, after installation this module enables a new FormElement type called "entity_reference_autocomplete_add_more".
Example code:
<?php
$form['field_name'] = [
'#type' => 'entity_reference_autocomplete_add_more',
'#target_type' => 'entity_type',
'#title' => $this->t('Field label'),
'#selection_settings' => ['target_bundles' => ['bundle_name'], 'match_limit' => 15],
'#default_value' => [0=>['target_id' => 123],1=>['target_id' => 234]],
];
?>