Closed (works as designed)
Project:
Drupal core
Version:
x.y.z
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Sep 2006 at 13:57 UTC
Updated:
10 Oct 2006 at 03:20 UTC
Trying to programmatically create a new node type, I do:
$values['name'] = 'node type test';
$values['type'] = 'node_type_test';
$values['description'] = 'my description.';
$values['comment'] = 0;
drupal_execute('node_type_form', $values);but I get:
warning: call_user_func_array(): First argumented is expected to be a valid
callback, 'node_type_form' was given in /includes/form.inc on line 181.
I am puzzle because the function does exist in modules/node/content_types.inc:
function node_type_form($type = NULL) {
Comments
Comment #1
chx commentedyes but you need to include that inc.
Comment #2
beginner commentedwith Drupal 5, we are supposed to be able to programmatically submit forms using drupal_execute(), and if you cannot do so, it is a bug.
I just don't understand the reason for this particular bug, yet.
Comment #3
chx commentedthe form you are submitting to is not included automatically on every page load, you need to do that by hand.
Comment #4
beginner commentedSo?
How do I programmatically submit a form to create a new node type?
Comment #5
beginner commentedOh! I see what you mean... let me try...
Comment #6
beginner commentedNow that you have shown me, TWICE, the solution, I find it's obvious and I kick myself for not having thought about it myself!!
I apologize for being so thick-headed!
The missing line: