Hi drupal developers,

1. Add content type named ddddd
2. Add content with the 'ddddd' type
3. Delete content type named ddddd
4. Edit the content

then it thrown such ERROR notice:

Notice: Undefined index: ddddd_node_form in drupal_retrieve_form() (line 806 in includes/form.inc).
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'ddddd_node_form' not found or invalid function name in drupal_retrieve_form() (line 841 in includes/form.inc).

I simply fixed as:

diff --git a/includes/form.inc b/includes/form.inc                                 
index 3840885..47eaf63 100644                                                      
--- a/includes/form.inc                                                            
+++ b/includes/form.inc                                                            
@@ -803,6 +803,10 @@ function drupal_retrieve_form($form_id, &$form_state) {       
     if (!isset($forms) || !isset($forms[$form_id])) {                             
       $forms = module_invoke_all('forms', $form_id, $args);                       
     }                                                                             
+    if (!array_key_exists($form_id, $forms)) {                                    
+      form_set_error('name', t('Content type :type is not available!', array(':type' => str_replace('_node_form', '', $form_id))));
+      return;                                                                     
+    }                                                                             
     $form_definition = $forms[$form_id];                                          
     if (isset($form_definition['callback arguments'])) {                          
       $args = array_merge($form_definition['callback arguments'], $args);

Regards,
Leslie Zhai

CommentFileSizeAuthor
content_type_is_not_available.patch707 bytesxiangzhai

Comments

xiangzhai’s picture

Issue summary: View changes
dcam’s picture

Component: forms system » node system
Status: Active » Closed (duplicate)
Issue tags: -Content type, -form, -edit

This issue is a duplicate of #232327: Deleting node type leaves orphan nodes. That other issue has a patch that includes tests which needs review. If anyone is interested in helping solve this problem, then please help with the older issue.