Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
General
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Nov 2007 at 23:34 UTC
Updated:
15 Sep 2008 at 13:12 UTC
Attached patch includes a snippet of code to facilitate importing in content_copy. This can save the need for site admins to copy and paste text from a file. Instead, we feed in a file path and it's pre-loaded in the macro field.
And a sample usage:
// If Content Copy is enabled, offer an import link.
if (module_exists('content_copy')) {
$form['macro'] = array(
'#type' => 'fieldset',
'#title' => t('Create a content type'),
'#description' => t('Follow this link to create automatically a content type and import preconfigured fields.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['macro']['link'] = array(
'#type' => 'markup',
'#value' => l(t('import'), 'admin/content/types/import', array(), 'macro_file='. drupal_get_path('module', 'my_module') .'/my_content_type.txt'),
);
}
| Comment | File | Size | Author |
|---|---|---|---|
| content_copy-preload.patch | 805 bytes | nedjo |
Comments
Comment #1
moshe weitzman commentednifty ... eaton is working on code defined fields and so on ... not sure what committers could so with this snippit.
Comment #2
drewish commentedDid this feature make it anywhere? I'm really keen on the idea of being able to define fields as part of a hook_install() or hook_update_N().
Comment #3
karens commentedBumping this forward. It seems like a simple thing to add and it should still apply, I just don't have time to test it.
I think we need to move the snippet into some documentation as an example of how to implement it. It could go in the PHP docs, or in a README.txt.
Comment #4
karens commentedSince this is such a simple thing, I committed this to both D5 and D6. I altered it a bit so you can provide either just a macro to create a new content type or specify a specific content type to add the fields to, and I put the example into the PHP docs for Content Copy's import form.
I'm implementing this in the Date Copy module to add a link to easily add a Date field to an Event content type.
The really nice thing about this is that you don't have to do any fancy formatting of the import file, just paste your export text into a text file and link to it and it works fine.
Thanks!
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.