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.
As reported here if I activate a new field and I try to add it to a previously created Content Type it doesn't appear in the list unless I don't edit and save the content type itself (no real changes are needed). This looks more a usability problem than a real bug but could be confusing. Maybe it's a cache problem I don't know...
Comment | File | Size | Author |
---|---|---|---|
#11 | content_admin.inc_2.patch | 690 bytes | yched |
Comments
Comment #1
dodorama CreditAttribution: dodorama commentedsee: this tread
Comment #2
yched CreditAttribution: yched commentedthis one is actually clearer (plus it's the first report for the issue)
Comment #3
drewish CreditAttribution: drewish commentedyou need to clear the cache. the devel module makes it easy to do this.
Comment #4
drewish CreditAttribution: drewish commentedsorry, should have read this more clearly.
Comment #5
KarenS CreditAttribution: KarenS commentedI just ran into this on a new install where some cck fields were installed already and then another one was added. The usual recommendation for clearing the cache (go to the modules page and save it) did nothing to help the problem, the new field still would not appear on the list. You either have to manually empty the cache table (something most users cannot do) or save the content type to get the field to appear.
So it looks like we need to be sure to clear the field list cache when a new module is added. I couldn't figure out exactly where to do that, but maybe someone else can.
I'm upping this to normal -- it's *really* confusing when you install a new module and it doesn't appear on the list.
Comment #6
dodorama CreditAttribution: dodorama commentedYeah, many people facing this problem believes they have problem with contributed modules. Is that possible to mark this as annoying? :)
@karen (and all CCK contrib modules developers). Maybe to avoid people submitting issues because of this it could be useful to put a warning on module homepage and readme.
Comment #7
yched CreditAttribution: yched commentedmarked http://drupal.org/node/85977 as a dupe
This _is_ annoying in fact :-)
Comment #8
RobRoy CreditAttribution: RobRoy commentedSo to automate this do we just need some sort of cache_clear() call in each CCK contrib module's hook_install()? Installing devel and clearing the cache is obviously not a proper solution.
Comment #9
yched CreditAttribution: yched commentedYes, something like
cache_clear('content_type_info');
, probablyComment #10
yched CreditAttribution: yched commentedEr, wait, probably rather a call to
content_clear_type_cache();
, actually...I don't know much about hook_install, so I don't know exactly what you're allowed to call in there, or what is available.
Comment #11
yched CreditAttribution: yched commentedOK, I gave it a closer look.
Problem is, to be consistent, we have to clear the cached content types info on a field module install AND uninstall (because of the symmetric less-talked-about but related issue : "newly desactivated fields still appear etc...")
But 4.7 doesn't offer an _uninstall hook (5.0 does...)
So I came up with another approach : delete the cached info when the "add_field' form is displayed.
I has the advantage of being a simple 3-line addition to content_admin.inc, no per-field-module patch needed.
Patch for 4.7 (I think 5.0 would offer a more elegant solution for the
$_POST['edit']
check)Comment #12
yched CreditAttribution: yched commentedForgot to set the status
Plus we have another dupe for this :-) http://drupal.org/node/86378
Comment #13
yched CreditAttribution: yched commentedbump - this could use some reviews - and save much unnecessary support requests :-)
Comment #14
KarenS CreditAttribution: KarenS commentedI can confirm this works. I tested without the patch to add and remove a field and got the previous behavior (it showed up when it shouldn't and didn't when it should). I then applied the patch and tested both adding and removing a field and the field list displayed properly.
Thanks yched! I'm marking this RTBC.
Comment #15
KarenS CreditAttribution: KarenS commentedI've committed this change to both 4.7 and cvs. If someone comes up with a more elegant solution for the 5.0 version, we can make that change, but this is a critical bug and this fix will work, so I'm committing it.
Comment #16
(not verified) CreditAttribution: commented