I am new to Drupal and keep falling down the learning cliff that is called "creating custom modules".

What I can't figure out is which set of hooks I need to implement in order to: Create a custom content type with my module such that my module is used to display instances of that content type. Once installed, I want to set up my Module within a block, to display instances of the custom content type. Then I'd like content editors to create a new instance of my content type, fill out the form, and then have the PHP code in my module render the content type.

Any help getting up that learning cliff would be greatly appreciated!

So far, I've got these hooks:

hook_block_info - Standard stuff

hook_block_view - I am displaying hard coded stuff here, but how do I get access to the $node with the content type that needs to be displayed with code from my module? That is not passed as a parameter. Should I be hooking another function to render my custom content type?

hook_node_info - Standard stuff

hook_install - Installs a type, but not sure how to define custom fields in the type - do I do this here?

type_name_form - Creates a form for my type, but my content type has no custom fields - where/how do I add those?


nevets’s picture

What do you need that using the UI will not provide?

eniveld’s picture

When my custom module is installed, I would like it to install a type, complete with all the fields that it requires. I do not want the Drupal administrator to have to configure the type using the Field UI. Does that make sense?

VM’s picture