Field Entity Autocomplete filter the published nodes my problem is that I have a custom form with an autocomplete entity field for the search.
The problem is that the field shows me both the published fields and those that do not. Is there any filter or parameter to prevent this from happening?

$form['my_element'] = array(
'#type' =&gt; 'entity_autocomplete',
'#placeholder'=&gt;'Search',
'#target_type' =&gt; 'node',
'#selection_settings' =&gt; [
    'target_bundles' =&gt; array('products'),
  ],
);
The entity reference appears on the registration form, and the applicant is able to view and choose unpublished nodes from the list. 

An anonymous user can see nodes of this type, but obviously they are not meant to see unpublished nodes of this type. On the rest of the site, they cannot see these unpublished node (only the autocomplete ignores this.)