Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is this only happening to me?
I'e just installed CCK for 4.7 on a test site, and have been playing with it, and I've noticed that when I delete a content type, the fields that were attached to it remain in the fields listing under admin. It looks as though they're stuck there for good - there's no way to delete or change them, beyond perhaps going into the database and excising them manually.
Is there a reason for this?
Is there a problem with my install?
Am I just not understanding something?
Comments
Comment #1
edrex CreditAttribution: edrex commentedConfirmed.
Deleting a content type leaves fields in place. The behavior should be the same as for removing a field from a content type: each field which isn't used by any other type should be removed.
I'll take a look at this.
Comment #2
Coyote CreditAttribution: Coyote commentedI _can_ see how it might be useful to leave fields in place until deleted by the user, in case one deletes a content type, but wants to re-use the fields. But there does need to be some way to clean up the fields in that case.
But failing that, yeah, I guess that recreating a field does only take a few moments. ; )
Comment #3
edrex CreditAttribution: edrex commentedI looked at this, and I can see what needs to change, but I don't know this code well enough to make a patch without potential unintended consequences.
The code in _content_admin_field_remove_submit that decides what to do with the row in {node_field} needs to be duplicated in _content_admin_type_delete_submit. I think that I would factor that code out into a new function.
Comment #4
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedThis is still an issue. I deleted a content type and when creating a new ct I got the old fields offered, but chosing one of them gave me a db error:
content_alter_db_field INSERT INTO node_data_field_autor (vid, nid, field_autor_uid) SELECT vid, nid, field_autor_uid FROM node_
content_alter_db_field ALTER TABLE node_ DROP field_autor_uid
Note the broken table names.
Comment #5
JonBob CreditAttribution: JonBob commentedFixed in 4.7 version. This fix only affects newly deleted content types; still need to take care of orphaned fields. HEAD patch pending.
Comment #6
(not verified) CreditAttribution: commented