"Content type import/export" conflicts with "Vertical Tabs"

yanku - June 17, 2009 - 11:12
Project:Vertical Tabs
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Dave Reid
Status:closed
Description

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

#1

KarenS - July 24, 2009 - 09:36
Status:active» needs review

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.

AttachmentSize
vertical_tabs.patch 706 bytes

#2

dmitrig01 - July 25, 2009 - 05:26
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.

#3

dmitrig01 - July 25, 2009 - 05:26
Priority:normal» critical

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

#4

Dave Reid - July 25, 2009 - 05:30
Assigned to:Anonymous» Dave Reid

I can get to this tomorrow.

#5

Dave Reid - July 26, 2009 - 05:28
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?

#6

KarenS - July 26, 2009 - 10:23

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 :)

#7

CarbonPig - July 30, 2009 - 19:03

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

AttachmentSize
export_data.txt 5.82 KB

#8

CarbonPig - July 30, 2009 - 19:04
Status:fixed» active

Opening

#9

Dave Reid - November 6, 2009 - 20:37
Version:6.x-1.0-beta3» 6.x-1.x-dev
Status:active» needs work

#10

Dave Reid - November 6, 2009 - 20:38

#11

Dave Reid - November 6, 2009 - 20:59

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

#12

Dave Reid - November 6, 2009 - 23:08
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():

<?php
/**
* 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.

#13

System Message - November 20, 2009 - 23:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.