Posted by mitchell on July 6, 2006 at 9:38pm
7 followers
Jump to:
| Project: | Content Construction Kit (CCK) |
| Version: | 6.x-2.x-dev |
| Component: | content_copy.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | actions, CCK, progammatic drupal |
Issue Summary
I would like to automatically create a generic node-type when a new term is added to a taxonomy called "node types" described here: http://drupal.org/node/72505 . This may call for the action module, but I'm not sure at all.
Another intersting idea on top of this would be to make fields for the newly created node type based on the categorization of the new term.
Comments
#1
#2
I doubt this will make it into the 4.7 version and node type creation is handled by core in 5.0, so I think this is probably a 'won't fix' item.
#3
This is an idea I had a long time ago.
Since then, meba and I worked out a similar solution here: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/vps_api/
Check out the first function in the .install file and the CCK include file.
#4
moving back to CCK
#5
CCK doesn't manage node types, so this doesn't belong to CCK.
Bouncing back :-)
#6
@yched: Forgive me for bouncing this issue around a lot, but I'm 99% sure this isn't a Rules issue. I think this new title & component description may provide a different (hopefully more accurate) perspective.
This idea relates heavily to efforts in Content Type Inheritance Module and #118863: CCK: Allow modules to expose default fields for node types. There is also a core issue too: #100925: Bundle inheritance.
Similar efforts that make site building less dependant on Drupal's admin UI:
#330141: Allow modules to expose default flags
#223404: Programmatically creating a view
#367792: creating tabs programmatically
#119865: Programmatically write text config files
#289044: Create preset programmatically
This search of all Drupal issues that use 'programatically' has been very helpful in finding more examples.
#7
Current Install Profile API issue: #214395: Generate CCK field type data.
#8
I'm not saying it's a Rules issue, I'm saying it's not a CCK issue. CCK doesn't manage node types, it's not its job, so it won't be providing actions to create new node types.
Might be the job of a new contrib module, but CCK won't provide that.
For the CCK point of view, this is a won't fix.
#9
@yched: I thought that's what content_copy did, but I see I was wrong [according to content_copy.module]:
// There's no API for creating node types, we still have to use drupal_execute().module_load_include('inc', 'node', 'includes/content_types');
drupal_execute('node_type_form', $type_form_state, $type);
mfredrickson referred to using drupal_execute as "hackish" in http://drupal.org/node/58153#comment-395374 :
@yched: Can you point me in the direction of efforts to make an API for node-type creation? Is this a likely route, or would any node-type creation method have to use drupal_execute for the foreseeable future?
#10
Short answer: Drupal needs more CRUD functions in core. So, ideally, this would become a core function, probably part of node.module.
#11
@Boris Mann: Where is that development going on? Feel free to move this issue.
Would an action to create a node type have to use drupal_execute?
#12
Er. Could someone summarize this issue..? http://api.drupal.org/api/function/node_type_save/7 creates a node type programmatically. I don't understand what's being asked for here.
#13
#14
@webchick: Thank you for pointing that out. The idea is to make an action that performs node_type_save.
#15
Ok, I understand the issue now. Thanks!
I have no idea if this is possible with the current actions system; how would you pass in all the required parameters like title, name, etc. to create the content type? But if someone can figure it out, seems like it could be useful.
Will need to add tests for this too to demonstrate that it works.
#16
additional term
#17
Subscribing
#18
I'm 95% sure that this configurble "Save content type" action would be best programmed with content_copy_import_form_submit. It uses drupal_execute and handles both content types and field definitions.