Drupal modules development

Events happening in the community are now at Drupal community events on www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

This training is intended for developers who have already a solid knowledge of Drupal, from a user's perspective. Prior knowledge of HTML, javascript or CSS are a plus.

The goal of this training

Learn how to expand Drupal to your needs, and how to use the community power for that purpose.

Duration

At least 2 days

Logic

In order to expand Drupal, one has to know how it already works, and what are his options, when choosing how to expand.

The class begins with an introduction to the structure of Drupal and how it is very similar to an operating system. Drupal system of loadable/pluggable modules allows it be to infinitely extensible. Drupal's core set of module is explored first and compared against contributed modules especially highlighting the importance of "core".

Before any development begins there is an overview of the folder and file structure of a module so that all the key pieces of modules are known as well as having a visualization of what is going to be created.

The Tools and Rules is located in the beginning of the syllabus but it can be moved to a later section in the course. It is important to cover this in class.

After the structure of Drupal has been explained, an outline of a Drupal module, and, possibly, coding standards/secure-code the class dives straight into development. Development begins slowly by exploring the hook system, steps up to creating custom DB tables, and finally moves into the Forms API (FAPI).

The syllabus

Introduction:
How is Drupal built?
- What is "Core"
- Drupal's folder structure and why its important.
-- The ever important sites folder
- /modules, sites/all/modules, sites/mysite.com/modules
-- Which one is used? How do you know?
- Drupal's module weighting and selection process
- basic structure of a module - .module, .info, .install files

Tools and Rules
- Drupal coding standards
- Doxygen, and its importance
-- demonstration of api.drupal.org and the API module
- writing secure code
- Tricks of the trade
-- Devel and coder module

Hooks
- We fishing or writing code?
-- Overview of what a hook is
- Demonstration of a hook
-- Simple module implementing hook_nodeapi and drupal_set_message($op).
- naming conventions
- introduction to few important hooks: init, menu, nodeapi, block, user
- How to create your own hooks for other modules

Database
- What if you need custom storage?
- adding a table to Drupal's DB
- using the .install file for installation and updating
- D6, the schema API and why

Forms API
- FAPI, uugggh another acronym don't be scared FAPI is good
- Why use an API? writing forms HTML is really easy!
- A simple form
- validating the form
- submitting the form
- hook_form_alter() hooks for forms! WOW, can you feel the power!?!

Custom nodes
- How to create a custom node
- Why not just use CCK? A comparison
- A node module's tacklebox hook_load, hook_update, hook_delete, etc.

Theming
- the theme_ function and when to use
- print vs. return

Sherlock Holmes
- Analyzing a core module
-- peering into the node module
-- peering into the comment module
- demystifying the magic of "core"

Taking it to D.O
- Creating a project on drupal.org
- Getting CVS access
- becoming a maintainer
-- what does it mean?
-- what if I don't have time?
- Managing the issue's queue

Exercises
Creating a non-node module part 1/3
- Create a new module called user_info
--- Create the .info and .module file, enable the module
- Implement hook_user to store the IP address of the user when they registered their account
-- Store this in the data column of the user table
- Implement hook_user to display this IP address on the user's profile page
-- "You originally registered from IP address: 192.168.0.1"
- Implement hook_user to display user statistics on the user profile page
-- How many nodes the user posted
-- How many comments the user posted

Creating a non-node module Part 2/3
- Create an administrative settings page for the module
-- /admin/settings/user_info
- Use Forms API (FAPI) to provide...
-- A category entitled "User profile display settings"
-- a checkbox with the label "Originating IP"
-- a select box containing show, hide and the label "Node statistics"
-- a select box containing show, hide and the label "Comment statistics"
--- optionally a radio selection with a "display node stats, display comment stats, display both"

Creating a non-node module Part 3/3
- Create a tab on the user profile page that display the IP and statistics
- Create a tab on a node page entitled "Author's other work"
-- utilize theme('table') to create a table listing with links to the author's other nodes
- Create a hook for other modules to implement entitled "user_info_tab"
-- The hook will put additional information on the user's profile page
-- create a second module that implements this hook.

Development resources.
- api.drupal.org
- FAPI Reference

Curriculum and Training

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week