I'm not sure whether this is a bug with cck or the notifications module, but i suspect maybe cck so i'll file it here first.
I have cck enabled + the notifications module, and a content type i want to import has notifications settings on 'edit' tab for the content type. When i try to import it i get illegal choice detected error.
the exported content type looks like -
$content['type'] = array (
'name' => 'A Group Posting',
'type' => 'group_post',
'description' => 'A Group Post content type for Organic Groups',
'title_label' => 'Title',
'body_label' => 'Body',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'upload' => '1',
'comment' => '2',
'comment_type' => 'comment',
'comment_view' => 'nodecomments_threaded',
'old_type' => 'group_post',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'og_content_type_usage' => 'group_post_standard',
'content_profile_use' => 0,
'notifications_node_ui' =>
array (
0 => 1,
'form' => false,
'comment' => false,
'links' => false,
'teaserlinks' => false,
'subform' => false,
'block' => false,
),
'notifications_content_type' =>
array (
'group' => true,
'grouptype' => true,
'author' => true,
'typeauthor' => true,
0 => 1,
'thread' => false,
'nodetype' => false,
),
'ant' => '0',
'ant_pattern' => '',
'ant_php' => 0,
);
The culprit is the 0 => 1, part of the notifications_content_type array and the same in the notifications_node_ui part of the array. If i remove the 0 => 1, from each of the arrays and then try to run the import the import runs successfully and the content type is installed.
thanks
Graham.
Comments
Comment #1
jvj commentedHi,
I'm experiencing this problem, a year after it was reported !? so I wonder if anyone found a way to solve this.
I'm aware of the other similar problem http://drupal.org/node/375200 and http://drupal.org/node/462720.
The former seems not to be related to notifications, therefore I suspect problem is in CCK Content Copy. I also tried looking into notifications code and could not find anything wrong.
In my case the '0 =>1' element is only in the notifications_node_ui array. Also, the problem seems to reappear after removing the element, importing (creating new type) and exporting the new type again.
I can reproduce the problem easily by
- create new content type with not additional fields and with default values when ever possible, i.e. I only defined Name, Type and Description for the new type
- export the type, the 0=>1 appears in the notifications_node_ui array
- delete the type
- import back (fails), remove the 0=>1 and try again (succeeds), but the next export shows the problem again.
Comment #2
jvj commentedUpdating the problem CCK version (6.x-2.7).
Marked http://drupal.org/node/375200 as duplicated.
Comment #3
jvj commentedI tried debugging this by tracing the code up to point where the '0 => 1' gets injected into notifications_node_ui array, and I'm not any more sure if this is even a problem or if the problem is in fact in the core ... anyways hopefully someone finds this helpful.
Here's what I think is happening:
first the content_copy.module handels the export request:
then the form.inc handles the form processing as follows ( as a kind of a top-down pseudo-callstack, '// (x) =>' are my comments)
As a result the Subscriptions UI form element (type=checkboxes) has been given field (on line (1) )
After this I run out of time and had to stop, but my guess is that this value gets somehow added to the actual checkbox values...I'm bit confused with all this because the drupal documentation (or the drupal book) does not mention checkboxes form elements to use the #value at all ?
Btw. The #default_values of the checkboxes at the (1) is
so it's still 'clean'
hope this helps, I might give this another look if I have time on monday...
Comment #4
alberto56 commentedSame problem here. I'm using the feedapi module and some of feedapi's parsers. Feedapi lets content of one type generate content of another type, with a given input format. If you haven't yet defined said input format, I imagine that when the form is rendered, it automatically defaults to the default input format (often 1), even though in the database it is zero. I wonder which module is best placed to correct the situation, content_copy or the myriad of contrib modules which alter the content type form.
Comment #5
marcvangendIsn't this a duplicate of #383482: Cannot import non-existing node types with export?
Comment #6
SchwebDesign commentedThis solved the issue for me as well:
removing
although i only had that within notifications_node_ui
not notifications_content_type