Drupal Content Type Module Skeleton

If you're a big fan of CCK, you've probably noticed that there are limitations eventually. It does fantastic work with data, but not so much with the nodes themselves. If you need things like access rights, redirection after XYZ, or custom permissions for business logic, you will like end up having to create your own content type through a module. Following is a very simple copy paste you can use to get started. It's got the most common hooks in there. Just copy and replace 'node_type' with whatever you wish yours to be.


Embedding a view with arguments

Assuming you're after putting a block in, pretty much anywhere you want, you'll need control over which url token you may be using at any point. Here's the code to read a url token, and embed a view based off it.


Database updates for Drupal CCK Fields

I recently need to create a CCK version of a previously taxonomy driven process on a node type. While at this I discovered the various things that have to be changed to make it happen. A big piece of the puzzle was the caching process from drupal. Once created, a node is cached in the cache_content table in a serialized form. If you do any changes, you need to delete the cache so the next time it's loaded (for editing or viewing) drupal rebuilds the cache.



Subscribe to Fragmented Thought RSS