"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
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.
#2
I'm about to go offline for a few days, so I can't commit this, but it's ready.
#3
Also, to whoever commits this, please test and then roll a release
#4
I can get to this tomorrow.
#5
Tested and committed this patch to 6.x-1.x. Do we get errors with programmed node forms as well?
#6
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
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
#8
Opening
#9
#10
Marked #605288: Export content type definitions from cck export function doesn't work as a duplicate of this issue.
#11
Marked #481118: Errors when importing content type as a duplicate of this as well.
#12
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
Automatically closed -- issue fixed for 2 weeks with no activity.