I added a field to a vocabulary, then added it to a content_type, I went to remove it from the content_type, went back to the vocabulary to remove it from there also, but it was already removed from there, which was quite unexpected.
Tried it 4 more times, tables renamed in database (as I read it should be for when permanently deleting something), but that begs the question, how does one just remove a field from one thing but not another? There's no extra options under editing, nor any extra links, that I can see.
It feels like the delete link should be on the fields section if it is to remove the field from all content types (which is actually quite a nice idea), with a remove link for the content type/etc. on manage fields section.
(Tried IRC and twitter, searched issues, but no answer on this, but sorry if it's duplicate or I'm missing something; I feel like I am)
Comment | File | Size | Author |
---|---|---|---|
#10 | field_ui_delete_field-706962-10.patch | 15.16 KB | yched |
#9 | field_ui_delete_field-706962-8.patch | 3.26 KB | yched |
Comments
Comment #1
hefox CreditAttribution: hefox commented[11:31am] DamZ: hefox: I think the "impossible to delete a field instance" is just
basically a bug
[11:31am] DamZ: hefox: I saw that too
Comment #2
chx CreditAttribution: chx commentedI think there is a deferred deletion involved which only happens on cron -- it needs to delete the values of the instance but there can be real lots hence this way.
Comment #3
hefox CreditAttribution: hefox commented(Not sure if you saw my reply on irc)
Yeah, I know about the deferred deletion; noticed it mention in other issue queue post. That isn't the issue.
content type a has field_a
vocabulary b has field_a
Remove field_a from content type a.
field removed from content type a
field ALSO removed from vocabulary b, without deleting it from vocabulary b.
As far as I can tell, there's no way just to remove it from content type a. @.@!
I like having a way to delete the field from anything, but it'd be .. not fun to not have the ability to remove it from just one thing.
I've also tried it when the .. entity? type is the same, ie content_type_a and content_type_b and the behaviour is the same. There was no content at this stage.
Comment #4
webchickThis sounds critical...
Comment #5
hefox CreditAttribution: hefox commented(adding in fields in core tag and changing title after reading http://drupal.org/node/707832)
Comment #6
yched CreditAttribution: yched commentedCritical indeed. Will try to look into this later tonight.
Comment #7
yched CreditAttribution: yched commentedLOL @ parenthesis typo :
if (count($field['bundles'] == 1)) { delete field }
(field_ui.admin.inc)What do you mean, "it's not funny and how come we don't have a test" ?
Well, you might have a point.
That part needs a bit more care anyway, since after #470242: Namespacing for bundle names, $field['bundles'] is keyed by object type first, so it might have 1 entry but several bundles in it (all for the same object type).
Working on it, and on a test.
Comment #8
yched CreditAttribution: yched commentedRevealed a bug where the sequence
would cause the $field['bundles'] property, gathered by field_info_field(), to grow with duplicates :
Attached patch should fix this, and the original bug.
No time to add the test tonight, so CNW.
Comment #9
yched CreditAttribution: yched commentedRight, and the patch.
Comment #10
yched CreditAttribution: yched commentedSame fix, with tests.
The patch adds a little sanity to Field UI tests, that are currently a giant single CRUD scenario.
Introduces helper functions to create and delete fields through the UI, and uses them to test 'deletion' separately
As a consequence, patch is kinda big, but the actual code fixes are the same 3k than patch #9.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedI reviewed #9 and it looks good. #10 adds test sanity and since bot is happy, so am i. rtbc.
Comment #12
webchickAwesome clean-up. Thanks for this yched, and to hefox for the original bug report. :)
Committed to HEAD.