Download & Extend

Expose a "Save content type" action

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

Priority:normal» minor

#2

Status:active» closed (won't fix)

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

Title:automatic creation of generic node types» CCK Integration: Action to create a node type
Project:Content Construction Kit (CCK)» Rules
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:General» Provided module integration
Priority:minor» normal
Status:closed (won't fix)» active

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

Title:CCK Integration: Action to create a node type» Action to programmatically create a node type
Project:Rules» Content Construction Kit (CCK)
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Provided module integration» Rules Integration

moving back to CCK

#5

Project:Content Construction Kit (CCK)» Rules
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Rules Integration» Provided module integration

CCK doesn't manage node types, so this doesn't belong to CCK.
Bouncing back :-)

#6

Title:Action to programmatically create a node type» Programmatically create a node type by exposing a configurable action
Project:Rules» Content Construction Kit (CCK)
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Provided module integration» content_copy.module

@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

Status:active» closed (won't fix)

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

Issue tags:-rules integration+actions, +CCK

@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 :

Right now, this is pretty hackish. Since there aren't any useful functions to save data (only the form submission forms) I've had to mangle the input data to look like a form. This works ok for some things, and not very well for others. Specifically, handling field submission is tricky - especially in setting the widget settings. I'm still not sure exactly how to structure this process.

It would help me greatly if there were programmatic ways (not just form submission methods) to content types and (more importantly) fields. This would require significant refactoring of the code in content_admin.inc.

@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

Project:Content Construction Kit (CCK)» Drupal core
Version:6.x-1.x-dev» 7.x-dev
Component:content_copy.module» node system
Status:closed (won't fix)» active

@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

Status:active» postponed (maintainer needs more info)

#14

Title:Programmatically create a node type by exposing a configurable action» Expose node_type_save in actions
Component:node system» trigger.module

@webchick: Thank you for pointing that out. The idea is to make an action that performs node_type_save.

#15

Title:Expose node_type_save in actions» Expose a "Save content type" action
Status:postponed (maintainer needs more info)» active

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

Issue tags:+progammatic drupal

additional term

#17

Subscribing

#18

Project:Drupal core» Content Construction Kit (CCK)
Version:7.x-dev» 6.x-2.x-dev
Component:trigger.module» content_copy.module

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.

nobody click here