Contributions API

content_copy.module

Version

1.25 (checked in on 2008/04/23 at 19:00:13 by karens)

Description

Adds capability to import/export CCK field data definitions.

Emulates the import/export process introduced in Views to export the field settings arrays as text them copy and paste text to import the field settings back into another content type.

Functions to create and playback macros borrowed from moshe weitzman's macro module. Macros created using drupal_execute() on the field settings form for each of the requested forms. Multi-part forms built using examples from Jeff Eaton's example at http://jeff.viapositiva.net/drupal/dynamic-forms.

You can export one or two fields and/or groups from one content type and import them into another content type in the same or a different installation, or export a complete content type with all groups and fields and create it as an exact copy in another installation.

Content type, group and field names will be imported exactly as exported. If the names are already in use, no import will be performed.

Note: The "display fields" information is being handled a little differently than the rest of the data that's imported and exported. Instead of calling through the create and playback macros, we get and set the data directly from/into the database. the reason for this is that the playback macro method does not lend itself well to the display fields.

Functions

Namesort iconDescription
content_copy_exportProcess the export, get field admin forms for all requested fields and save the form values as formatted text.
content_copy_export_formA form to export field definitions.
content_copy_export_form_submit
content_copy_fieldsGet all the fields for a content type.
content_copy_form_alterImplementation of hook_form_alter(). Intervene to run form through macro when doing export
content_copy_get_macro
content_copy_groupsGet all the groups for a content type.
content_copy_import_formA form to import formatted text created with export.
content_copy_import_form_submitSubmit handler for import form. For each submitted field: 1) add new field to the database 2) execute the imported field macro to update the settings to the imported values
content_copy_menuImplementation of hook_menu().
content_copy_record_macroA handler that stores the form submissions into a $GLOBALS array
content_copy_typesGet all content types.