I am trying to create an autocomplete field for users. The following code is fine for username searches but the requirement is for a search by any part of the user's first and last name.
$form['user'] = [ '#type' => 'entity_autocomplete', '#target_type' => 'user', '#selection_settings' => [ 'include_anonymous' => FALSE, ], ];
I am wondering what the best way to filter by first and last name is. Is it even possible to use 'entity_autocomplete'? It doesn't look like any of the EntityAutocomplete class methods would make this possible and I'm not clear on whether or not the '#selection_handler' and '#selection_settings' properties could be helpful.