Module Development

Build a node content type

Drupal 7 Reference Material
Whilst I'm converting from Drupal 7 (D6) to Drupal 7 (D7) I thought that I'd keep a set of useful notes and references online rather than private so that anyone can use them.
Whilst naturally I'm using a number of reference points I will try to maintain backward links to any site that I'm using material from. I'm certainly not intending to just copy and paste code in the hope that I get a search engine result.
If anyone feels I'm breaching their copyright please contact me and I'll remove the content

Programmatically change node settings

A couple of interesting finds whilst creating my own node type with a module.

Having built the node type through a module, I then spent hours trying to find out how to control the node form settings like comments and promote to front page. I even spent some time on the IRC but nobody knew the answer.

Sometime going through the API documentation is like digging through liqueified mud.

However the first way I found was to add this to hook_install

variable_del('comment_node_example');

Multiple Submit Buttons

Whilst creating a custom form, for a custom module that uses a non node content type, I came across an issue with multiple submit buttons.

Whilst Drupal does document using multiple submit buttons here:

http://api.drupal.org/api/drupal/modules--node--node.pages.inc/function/node_form/7

For all the tea in china I couldn't get this to work.

The form API seemed to pick up the first submit button and work with that.

Custom Drupal 7 Module

To really get under the hood of Drupal 7 I've decided to build an e-brochure module. Some would say that I should start with something easier but what the the hell I've already built it on Codeigniter so I've got the basics already.

Outline:

Default Text Field Types for nodes

Building a Module

I'm building a new module and after a lot of searching for the built in standard text field (body if you like) I found a link to the Drupal API http://api.drupal.org/api/drupal/modules--field--modules--text--text.mod... which shows all the stuff you need.