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?
<?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->get('system.entity_autocomplete')) {
$route->setDefault('_controller', '\Drupal\alter_entity_autocomplete\Controller\EntityAutocompleteController::handleAutocomplete');
}
}
}
Is there any way to do it?