views exposed filter to have dropdown of entity reference in cutstom entity I generated with drupal console utility my own module and content entity code. After I added a user entity reference field and a taxonomy term entity reference field.

Now I'm listing my content with views, I don't do nothing with the code generated the integration is done.

But, when I expose a filter by taxonomy field and user field it doesn't give me the option to show as a dropdown, it directly appears as a textfield.

In others views, listing nodes with entity reference fields, if I add exposed filter of entity reference  offers to me a dropdown or autocomplete widget.

What I have to change to my entity to have dropdown select for my entity reference field as exposed filter in a view?

Here is the field definition in the Entity class

    $fields['term_id'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Log type'))
  -&gt;setDescription(t('The term ID of the Log entry type.'))
  -&gt;setRevisionable(FALSE)
  -&gt;setSetting('target_type', 'taxonomy_term')
  -&gt;setSetting('handler', 'default:taxonomy_term')
  -&gt;setSetting('handler_settings', 
    array(
      'target_bundles' =&gt; array(
        'logs_type' =&gt; 'logs_type'
    )))
  -&gt;setTranslatable(FALSE)
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'inline',
    'type' =&gt; 'taxonomy_term',
    'weight' =&gt; -2,
  ))
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'entity_reference_autocomplete',
    'weight' =&gt; -2,
    'settings' =&gt; array(
      'match_operator' =&gt; 'CONTAINS',
      'size' =&gt; '60',
      'autocomplete_type' =&gt; 'tags',
      'placeholder' =&gt; '',
    ),
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);


Update:

I achieve to have a dropdown in the exposed filter in my view creating the file mymodule.views.inc and puting this code:

function log_activity_views_data_alter(&amp;$data) {
  $data['log']['term_log_tid_depth'] = array(
    'help' =&gt; t('Display content if it has the selected taxonomy terms, or children of the selected terms. Due to additional complexity, this has fewer options than the versions without depth.'),
    'real field' =&gt; 'term_id',
    'argument' =&gt; array(
      'title' =&gt; t('Log type (with depth)'),
      'id' =&gt; 'taxonomy_index_tid_depth',
      'accept depth modifier' =&gt; TRUE,
    ),
    'filter' =&gt; array(
      'title' =&gt; t('Has taxonomy terms (with depth)'),
      'id' =&gt; 'taxonomy_index_tid_depth',
    ),
  );
}


But when I choose a term to filter the view, it does not return any item and it should do so.
As Berdir said, as long as https://www.drupal.org/node/2429699 is not ready, you need to provide your own Views Filter plugin.

I created this plugin, based on TaxonomyIndexTid, for Nodes, see https://gist.github.com/StryKaizer/ae1cb9abc4844a9e7ac12317a9d84a78

You need to place this file in a custom module at yourmodule/src/Plugin/views/filter/NodeIndexNid.php, and also implement hook_views_data_alter in your yourmodule.module file, like this:

/**
 * Implements hook_field_views_data_alter().
 *
 * Views integration for entity reference fields which reference nodes.
 * Adds a term relationship to the default field data.
 *
 * @see views_field_default_views_data()
 */
function yourmodule_field_views_data_alter(array &amp;$data, FieldStorageConfigInterface $field_storage) {
  if ($field_storage-&gt;getType() == 'entity_reference' &amp;&amp; $field_storage-&gt;getSetting('target_type') == 'node') {
    foreach ($data as $table_name =&gt; $table_data) {
      foreach ($table_data as $field_name =&gt; $field_data) {
        if (isset($field_data['filter']) &amp;&amp; $field_name != 'delta') {
          $data[$table_name][$field_name]['filter']['id'] = 'node_index_nid';
        }
      }
    }
  }
}