Add more metadata to field type properties to identify text with a format and separate user provided text from machine names

Created on 24 May 2016, almost 9 years ago
Updated 3 February 2023, about 2 years ago

Problem/Motivation

Follow-up from #2725415: Text Editor module fails to track usage of images uploaded in text_with_summary fields, allows uploaded images to be deleted

Some quotes from there:

WimLeers in #35

_editor_get_processed_text_fields() essentially hardcodes text.module's field types. I'm not sure how we can get around that. I can think of work-arounds that will enable Drupal 8 contrib to inject more field types, but I cannot think of a way to have them being found automatically; the entity/field system metadata is not rich enough for that AFAIK. In the grand scheme of things, I think this is only a small flaw though, and one that is not caused by or inherent to this issue.

Berdir in #36:

In TMGMT, I have a similar but not identical problem. Given an entity with field definitions, I want to extract all translatable text from it. That can be text fields but also string and other field types. (but not list_string, as the values there are machine names, basically, similar to format). Additionally, and that's more related to the problems that editor.module has, I would have to know how format/value/summary are connected and for which properties a format is. See http://cgit.drupalcode.org/tmgmt/tree/sources/content/src/Plugin/tmgmt/S...

Proposed resolution

Add more properties/metadata to data definitions to help solve those use cases.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

10.1

Component
Typed data 

Last updated 24 days ago

  • Maintained by
  • 🇦🇹Austria @fago
Created by

🇨🇭Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • @kasperg opened merge request.
  • 🇩🇰Denmark kasperg

    I ran into this issue as well with the FAQ field module. As mentioned there the current approach which is based on extending from the TextItemBase class would require a rebuild of the module.

    An alternate approach would be to use an interface which fields could implement and provide a way to return formatted text content. I created a issue fork with an initial implementation of of such a EditorFieldItemInterface. Things are quite primitive but if other people like this approach it might provide a way forward.

Production build 0.71.5 2024