| Project: | Form Markup |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | import |
Issue Summary
I'm experiencing a similar issue to #553764: Editing 'Change basic information' of any CCK field erase Form Markup values, only in my case what's happening is that the prefix/suffix values for fields are getting dropped when using the CCK content_copy module to import a content type.
Steps to recreate:
* Create a new content type
* Add a simple text field with a prefix and suffix
* Export the content type & copy to the clipboard
* Delete the content type
* Paste the clipboard into the content type import form & submit
The content type & field get re-created, but the prefix/suffix definitions are missing.
form_markup 6.x-1.1.
CCK 6.x-2.6
#599224: Pass field by reference in hook_content_fieldapi seems potentially related - I may be digging into this more, I will post any relevant discoveries to this case.
Comments
#1
Re-implementing the prefix & suffix fields using hook_widget_settings_alter() instead of hook_form_alter() and a custom submit function seems to have done the trick. I need to do more testing, but if everything looks good I'll roll a patch; it greatly simplifies the module code.
#2
Attached is a patch against the latest version of form_markup.module from the DRUPAL-6--1 branch. It implements hook_widget_settings_alter() to add the prefix and suffix fields to the field settings form instead of the hook_form_alter() and custom submit function that had been handling it. This has the dual benefit of letting the Content module worry about modifying the field settings form and saving the prefix/suffix settings, AND making prefix/suffix field settings exportable with no extra work.
When I tested the patched module against a site that already had prefix/suffix values stored with version 6.x-1.1, those values were preserved; I don't believe any further upgrade logic is necessary, but this should probably be tested and verified by others.
#3
+1 Works ok for me.
Applied the patch. Now seeing prefix/suffix lines in export text, with the values saved into the form. Also added my own form fields to an export and put prefix stuff in. After import, all shows up nicely.