If the "Vertical Tabs" module is enabled, content types can't be imported with the setting "Content Type: create"

The following error message is outputted:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'brand_node_form' was given in /nfs/c02/h04/mnt/46842/domains/acuity.ch/html/clients/designundton/beta_v2/includes/form.inc on line 366.

An illegal choice has been detected. Please contact the site administrator.

See also: http://drupal.org/node/494016

CommentFileSizeAuthor
#7 export_data.txt5.82 KBCarbonPig
#1 vertical_tabs.patch706 byteskarens

Comments

karens’s picture

Status: Active » Needs review
StatusFileSize
new706 bytes

I ran into this to and it is also a problem in install profiles and anywhere else that anyone uses drupal_execute() on the content_type form as a method to programmatically create a content type. The fix is for vertical tabs to leave that form alone if it is a programmed form. This simple fix should take care of that.

dmitrig01’s picture

Status: Needs review » Reviewed & tested by the community

I'm about to go offline for a few days, so I can't commit this, but it's ready.

dmitrig01’s picture

Priority: Normal » Critical

Also, to whoever commits this, please test and then roll a release

dave reid’s picture

Assigned: Unassigned » dave reid

I can get to this tomorrow.

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Tested and committed this patch to 6.x-1.x. Do we get errors with programmed node forms as well?

karens’s picture

The same issue should apply, but I'm not using programmed node forms anywhere to test it. You could try it out by creating a node and trying to store it using drupal_execute(). It's probably safe to just assume that Vertical tabs should never do anything with any programmed form.

The node_type form is especially important because it's used by lots of modules to auto-create content types in install profiles and installation scripts, and that is now fixed :)

CarbonPig’s picture

StatusFileSize
new5.82 KB

Hi,

I'm using vertical tabs and when I export fields and then try and import them into a new content type (i.e. "create") I get the error: The import data is not valid import text.

I have attached my export text for review.

Is this the same issue you're trying to solve?

Hopefully this helps, or someone can point me in the right direction.

Cheers,

CarbonPig

CarbonPig’s picture

Status: Fixed » Active

Opening

dave reid’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Status: Active » Needs work
dave reid’s picture

dave reid’s picture

Marked #481118: Errors when importing content type as a duplicate of this as well.

dave reid’s picture

Status: Needs work » Fixed

Ok this should be fixed for any forms using vertical tabs now. I changed the logic of vertical_tabs_form_alter():

/**
 * Implementation of hook_form_alter.
 */
function vertical_tabs_form_alter(&$form, $form_state, $form_id) {
  // Add our color-handling submit handler to the color settings form.
  if ($form_id == 'system_theme_settings' && isset($form['color']) && function_exists('gd_info')) {
    $form['#submit'][] = 'vertical_tabs_color_submit';
  }

  // Skip programmed forms when adding vertical tabs.
  if ($form['#programmed']) {
    return;
  }

  // Check to see which form we are in. Since the node form's form id is not
  // just node_form, we can't implement a function for all node forms, so we are
  // stuck implementing the global form_alter and checking if there is the
  // string node_form in the form id.
  if (substr($form_id, -10) == '_node_form') {
    $node_type = $form['type']['#value'];

    // The $fieldsets array is a list of all supported fieldsets in core
    // for the node form, and their JavaScript summary creators.
    $fieldsets = vertical_tabs_fieldsets($node_type);

    if (vertical_tabs_add_vertical_tabs($form, $fieldsets)) {
      drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.node_form.js');
      $form['vertical_tabs']['#weight'] = 100;
    }
  }

  if ($form_id == 'node_type_form' && $form['#node_type']->type) {
    vertical_tabs_node_type_form($form, $form['#node_type']->type);
  }
}

We could possibly move this somehow to vertical_tabs_add_vertical_tabs as well down the road. I'm going to consider this fixed now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.