The flag form element is defined as 'flag' in flag_content_extra_fields($type_name):
$extra['flag'] = array(
'label' => t('Flags'),
'description' => t('Flags fieldset.'),
'weight' => 0
);
...but the flag weight is called in flag_form_alter() like so:
if (count($flags)) {
$form['flag'] = array(
'#type' => 'fieldset',
'#weight' => module_exists('content') ? content_extra_field_weight($form['#node']->type, 'flags') : 1,
'#tree' => TRUE,
'#title' => t('Flags'),
'#collapsible' => TRUE,
);
}
which causes content_extra_field_weight() to always fail here:
// If we don't have the requested item, this may be because the cached
// information for 'extra' fields hasn't been refreshed yet.
if (!isset($type['extra'][$pseudo_field_name])) {
//the above looks for "$type['extra']['flags']" instead of "$type['extra']['flag']" (the value that is actually set)
content_clear_type_cache();
$type = content_types($type_name);
}
which eventually causes nukage of cache_content in cache_clear_all(), and that seems bad :).
Apologies if I'm missing something, I'm not very familiar with cck internals.
Thanks!
Comments
Comment #1
cfennell commentedAttaching patch that calls 'flag' instead of 'flags'.
Comment #2
emmajane commentedPatch applies cleanly to 6.x-2.x branch.
Comment #3
quicksketchYay thanks guys. Committed to 6.x-2.x branch. Same problem does not appear in the 7.x-2.x branch.
Comment #4
cfennell commentedExcellent, thank you!
Comment #6
joachim commentedRequest to backport this to 1.x from #1600736: flag_form_alter clears the content type cache - every call :(.
Comment #7
joachim commented1.x is no longer supported, though I'll leave this open for a bit more as there's a patch here.
If someone ports this I'll commit & make a final 1.x release.
Comment #8
cck commented6.x-1.x patch ported from flag-content_clear_type_cache-1469442.patch
Comment #9
joachim commentedThanks!
Let's fire up the testbot...
Comment #10
joachim commentedCommitted!
Issue #1469442 by cck, cfennell, emmajane: Fixed calling 'flags' instead of 'flag' in content_extra_field_weight() always triggers content_clear_type_cache().
I'll roll a 1.5 release with this and then we will consider the 1.x branch closed.