When CCK forms are duplicated, the fieldgroup is not duplicated. I'm also receiving the following multiple warnings:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/mallee/public_html/sites/default/modules/cck/content_admin.inc on line 410.
The function area for line 410:
// The table was created in the form
// iterate through it and render form elements when placeholders are encountered
// then run the rows array through theme_table().
foreach ($form['#table'] as $weight => $frow) {
foreach ($frow as $delta => $item) {
foreach ($item as $fname => $field) {
$row = array();
$class = 'content-field-overview-enabled';
if (in_array($fname, $disabled)) {
$class = 'content-field-overview-disabled';
}
Line 410 is the if(in_array($fname...etc.
The errors show in watchdog, but don't appear in database cache.
Sorry to be such a pest! Seems I'm prone to problems.
Comments
Comment #1
marcp commentedAttached is a patch that fixes the problem of fieldgroups not being duplicated. I put a module_invoke_all('content_duplicate', ....) call in _content_admin_type_edit_submit() in content_admin.inc. The real work gets done in fieldgroup.module's new hook_content_duplicate.
A little bit of refactoring was done to keep from duplicating SQL that was already in place.
Comment #2
yched commentedI'm sorry but I don't get what's the issue in the first place and what the patch is supposed to address - can you provide a detailed description of the problem ?
Comment #3
marcp commentedHere is the problem that is addressed by this patch:
In CCK, create a new content type (admin/node/types/add) and call it abc.
Add two fields (call them f1 and f2) to the new content type (admin/node/types/content_abc/add_field).
Add two groups to the new content type -- call them group1 and group2 (admin/node/types/content_abc/add_group).
Move f1 into group1 and f2 into group2 from the manage fields tab (admin/node/types/content_abc/fields).
Now, from admin/node/types, find the new content type and click duplicate (admin/node/types/content_abc/duplicate)
You should notice that the fieldgroup data doesn't get copied over. All the fields are there, but the fieldgroups are missing. This is actually a big pain when you've got a lot of fields in a type that are all assigned to groups.
Let me know if this describes it well enough. It would be great to get this patch in there.
Comment #4
marcp commentedOops, I changed the subject by accident on the last comment.
One other piece of information is that you need to activate the fieldgroup module, but I assumed that people would know that since this is filed against the fieldgroup module...
Comment #5
fagohm, I don't its a good idea to introduce a new hook for just one module. Here is another simple patch, which works fine for me.
Comment #6
yched commentedYes, +1 for not adding a hook.
But I think the code could go in a fieldgroup_duplicate function in fieldgroup.module, called inside the
if (module_exist('fieldgroup')) {}block in content_admin (this keeps code dealing with fieldgroups tables contained in fieldgroup module)Comment #7
fagoyep, that's right. here is an updated patch.
Comment #8
yched commentedLooks RTBC to me
Comment #9
fago-> committed to the 4.7 branch.
Comment #10
marcp commentedThank you for getting this in 4.7 -- it's much appreciated. Does anything need to be done to get it into 5.x?
Comment #11
yched commentedNo, the 'duplicate' functionnality does not exist per se in 5 branch. It is handled by content type import / export facilities, which should handle fieldgroups OK.
But thanks for the proposition :-)
Comment #12
(not verified) commented