Download & Extend

content_copy_import_form_submit breaks when submitting a form programatically

Project:Content Construction Kit (CCK)
Version:5.x-1.5
Component:General
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

when submitting the 'content_copy_import_form' with drupal_execute(). The following at the end of content_copy_form_submit breaks things because it explicitly calls drupal_goto()

  if (!form_get_errors()) {
    if (sizeof($imported_fields) > 0 || sizeof($imported_groups) > 0) {
      drupal_goto('admin/content/types/'. $content_info['content types'][$type_name]['url_str'] .'/fields');
    }
    else {
      drupal_goto('admin/content/types');
    }
  }

The fix is to change the drupal_goto calls to returns, like so:

  if (!form_get_errors()) {
    if (sizeof($imported_fields) > 0 || sizeof($imported_groups) > 0) {
      return 'admin/content/types/'. $content_info['content types'][$type_name]['url_str'] .'/fields';
    }
    else {
      return 'admin/content/types';
    }
  }

this allows multiple drupal_execute('content_copy_import_form', $form_values) to be placed into one function and program flow will execute correctly. I am using this to create multiple cck types during a _profile_final() call.

I can whip up a patch file if needed, but its a simple change.

-Steve

Comments

#1

Status:active» fixed

Yep, this has been reported many times, and I finally took the 30 secs to actually commit the fix...

#2

Status:fixed» closed (fixed)
nobody click here