How to change the format that shows the autocompletion of reference entities? I am trying to change the format that it shows by default in the text fields that have an associated reference entity.

I found an article where a format modification is made, I think it may be a good starting point, but this module changes the format of all the fields of the whole site, what I am trying to do is that I can define the format by type of content, that is, for Articles, it would have one format and another type of content, depending on what is most convenient.

For example, in the module mentioned, it changes the behavior of the autocomplete globally, is there a way to do it by type of content?

&lt;?php
namespace Drupal\alter_entity_autocomplete\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;

use Symfony\Component\Routing\RouteCollection;

class AutocompleteRouteSubscriber extends RouteSubscriberBase {
  public function alterRoutes(RouteCollection $collection) {
    if ($route = $collection-&gt;get('system.entity_autocomplete')) {
      $route-&gt;setDefault('_controller', '\Drupal\alter_entity_autocomplete\Controller\EntityAutocompleteController::handleAutocomplete');
    }
  }
}


Is there any way to do it?

The github project of the module
You can filter for the entity type &amp; bundle in the getMatches() method.

It is also possible to add specific handlers to your forms: https://www.qed42.com/blog/autocomplete-drupal-8