Problem/Motivation

With the ability to track HTML link discussed in #2950107: Add plugin for tracking non-LinkIt links in WYSIWYG fields and #2954973: Track absolute URLs in link fields, the pattern now used to check if the route is an entity or not is '/^entity\./', but this pattern might not be enough like I have a case I want to track route media_entity_download.download, or might be over-track routes that are not desired as mentioned and suggested in #2954973-33: Track absolute URLs in link fields to use entity.*.canonical.

Proposed resolution

Choose a safe default route pattern, and then make it configurable somehow.

Comments

weynhamz created an issue. See original summary.

weynhamz’s picture

Title: Allow entity route pattern to be configurable » Allow entity route pattern for HTML Link tracking to be configurable
weynhamz’s picture

Title: Allow entity route pattern for HTML Link tracking to be configurable » Support more entity route pattern?
Issue summary: View changes

Actually, it is more than just make the regex pattern configurable, it also requires to correctly get the entity type and entity id from the route, which sounds like an extension point.

We might need to create a plugin system to allow modules to provide their own way to decide which entity should be tracked from a URL route.

weekbeforenext’s picture

dave reid’s picture

I think as a best practice, contrib module adding entity specific routes should extend the `entity.TYPE.module_route` route name rather than their own routes. I filed #3575225: Rename media_entity_download.download route to entity.media.download (compatibility with Entity Usage link tracking) to fix this upstream in Media Entity Download.