backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Allow fully deleting text formats #4013

Open ghost opened 5 years ago

ghost commented 5 years ago

This is a follow-up to https://github.com/backdrop/backdrop-issues/issues/1575. That issue allowed disabled text formats to be re-enabled via the admin UI.

This issue is to discuss allowing text formats to be fully deleted/removed from a site (their config files deleted). Concerns revolve around whether this should be allowed at all, and if so, what should happen to content that uses a deleted format.

ghost commented 5 years ago

In my mind it should be a given that we allow deleting text formats (for consistency with the rest of Backdrop (e.g. content types, fields, users, etc.)), so therefore the discussion should instead be around how to deal with content that uses a deleted format. To that end, what about displaying text that uses a deleted format in a sanitised way (stripping all HTML, PHP, etc.) (i.e. a hard-coded, internal-only, backup-type text format), and then allowing changing to an enabled format on next edit?

klonos commented 5 years ago

As mentioned on Gitter, when deleting a content type while there is still content of that type on the site, we show the number of pieces of content still using that format:

Screen Shot 2019-09-03 at 6 22 14 am

We have discussed the possibility to be tracking usage of text formats, and doing something similar in the "Remove" confirmation form. This may prove to be a lot of work though, as text formats are used all over the place (content, field config, views, custom blocks, etc.).

Another idea was to only allow removing disabled formats (before completely removing their config files). This does add an extra step in the process, and by then the user would have seen 2 warnings, which is more than enough to heed re the consequences.

ghost commented 2 years ago

Since text formats can already be disabled, the functionality for what to do with content that uses the format already exists (the content is simply not rendered). So deleting a text format is just a matter of removing the config file.

Here's a PR: https://github.com/backdrop/backdrop/pull/3928 I've made it so that only disabled formats can be deleted (this seems the safest option).