Similar to http://drupal.org/node/361838, but still occurring after that fix.

When importing a CCK type, I get the
call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'contribution_node_form' was given...
error followed by a slew of 'Illegal choice' errors for things like 'author', 'menu', 'path', etc. in the log.

Turning off Vertical Tabs while importing is a workaround.

Should the condition in vertical_tabs_form_alter() additionally check for type 'create'?

if ($form_id == 'node_type_form' && $form['#node_type']->type && $form['#node_type']->type != '<create>') {
CommentFileSizeAuthor
#2 vertical_tabs-481118-2.patch453 bytesrstaylor

Comments

quicksketch’s picture

Should the condition in vertical_tabs_form_alter() additionally check for type 'create'?

That check makes it so that Vertical Tabs doesn't try to make a node form for a content type that doesn't yet exist, since node/add/[type] isn't going exist until after the content type has been created. But it sounds like what might be happening is that content copy is not setting the $form['#node_type']->type value correctly, so it might be a bug in content copy rather than vertical tabs, though if there's a way to fix it in vertical tabs I'd be happy to change our module too.

rstaylor’s picture

StatusFileSize
new453 bytes

I was partly wrong. It turns out that $form['#node_type']->type is set to the soon-to-be-created type name (not '') when content_copy executes the form.

    // There's no API for creating node types, we still have to use drupal_execute().
    module_load_include('inc', 'node', 'includes/content_types');
    drupal_execute('node_type_form', $type_form_state, $type);

So it's executing the form programmatically for a content type that doesn't yet exist, but it does have the type set. I think the type has to be set or it would fail validation and couldn't be created.

Maybe a check for #programmed?

if ($form_id == 'node_type_form' && $form['#node_type']->type && !$form['#programmed']) {
dave reid’s picture

Status: Active » Closed (duplicate)