Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX] More info on field removal #3262

Open
laryn opened this issue Aug 24, 2018 · 4 comments
Open

[UX] More info on field removal #3262

laryn opened this issue Aug 24, 2018 · 4 comments

Comments

@laryn
Copy link
Contributor

laryn commented Aug 24, 2018

Describe your issue or idea

When deleting a field, we see this message:

If you have any content left in this field, it will be lost. This action cannot be undone.

This always makes me a little nervous, even when I'm pretty sure there is no content in the field. Actually even if I've checked the database directly to make sure there is none. 😄 This is an idea for feedback: can we check if there is any content in that field and tell the user whether there is or not instead of this broad brush approach?

It could be simply:

There is content in this field which will be lost. This action cannot be undone.

Or (for example) when deleting a field from the "Page" content type:

7 pages have content in this field which will be lost. This action cannot be undone.

@olafgrabienski
Copy link

olafgrabienski commented Aug 24, 2018

Good idea! I like the 2nd proposal because it makes also clear that the removal concerns only content of a certain type; that is helpful if you're going to delete a field which is shared across different content types.

Or wait ... to make it more clear, we should specify the content type (also) in the "Are you sure" question. Here an example for the current combination of question and message:

Are you sure you want to delete the field Body?
If you have any content left in this field, it will be lost. This action cannot be undone.

I'd propose:

Are you sure you want to delete the field Body from the content type Page?
7 pages have content in this field which will be lost. This action cannot be undone.

Hm, while "7 pages" or "7 posts" is fine, it might be difficult to get the correct plural form for other content types, so I guess we need to be slightly more formal, e.g. "7 items of the Page content type have content in this field ..."

@ghost
Copy link

ghost commented Apr 8, 2022

I've made a PR that changes the question to:

Are you sure you want to delete the field %field from %bundle?

Examples:

  • Are you sure you want to delete the field Body from Page?
  • Are you sure you want to delete the field Image from Tags?

I originally added in the bundle type as well (e.g. "delete the field Image from the vocabulary Tags?"), but the bundle name for nodes is 'Type', and the same for user accounts. "Are you sure you want to delete the field Photo from the type User account?" doesn't really work very well...

Also, I don't think it'll be possible to display the number of fields with content in them, since (AFAIK) that'll require an EntityFieldQuery, which requires a FieldCondition, which requires knowing what column in the DB the content for each field is stored in (e.g. textfields (and most other fields) use value, but file fields use fid). I guess this is why we're currently saying "If you have any content left in this field...", since there's no definitive way to check this...

@olafgrabienski
Copy link

I don't think it'll be possible to display the number of fields with content in them

That's a pity. @laryn - do you have any idea how to get the number of fields?

(Apart of that, the PR works for me.)

@ghost ghost removed their assignment Dec 5, 2022
@stpaultim
Copy link
Member

stpaultim commented Apr 20, 2024

There is an old PR here that doesn't entirely solve the problem that was raised, but it does make an incremental improvement. I like this idea and it would be pretty easy to move forward. Someone just needs to recreate this PR and submit it again. It's a pretty simple PR and would be fairly easy to recreate.

I've done this a number of times with PR's from folks who are no longer around to keep them up to date. Anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants