Problem/Motivation
Text formats can convert text into links. Entity usage needs to account for what the user sees not the raw field value.
Steps to reproduce
Add add text into a text field that uses a formatter that automatically converts links to URLs and link is an absolute link to an entity on your site.
Proposed resolution
If the text field's filter format has filter_url enabled then we should convert text into links before looking for links in \Drupal\entity_usage\Plugin\EntityUsage\Track\HtmlLink
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork entity_usage-3516678
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
alexpottNow to add test coverage...
Comment #4
alexpottI've been thinking about this issue and it makes me wonder if we should be maintaining:
I think we should have a single text field plugin that uses the processed text (and summary if available) to determine usage. The plugin should support entity usage discovery from both the URL and the
data-entity-uuidanddata-entity-typeattributes.This approach would have the following advantages:
Comment #5
alexpott@marcosano has pointed out that entity embed is a problem. Entity embed possibly will add links to other entities and we wouldn't want these usages registered as part of the entity with text field... so yeah #4 is wrong-headed.
That said I think it points to the fact that we could reorganise the plugin relationships so we only have to create the dom for each text field once.
Comment #6
alexpottComment #7
marcoscano@alexpott I am happy with the MR, but see the status is still NW. Did you want to include anything else or is this ready to go?
Thanks!
Comment #8
alexpottI think this is ready to go.
Comment #10
marcoscanoGreat, thanks! 🙏
Comment #11
marcoscanoJust tagged a new release with this and a couple other bug fixes.