To Do List API

To Do List offered Hooks

Since version 1.1, the To Do List module includes a few module_invoke() calls that other modules can catch via one of the following hooks.

hook_to_do_deadline_reached($node)

The specified To Do Item ($node) must be finished today to not be late. If the item is a meeting or conference, then it will be missed if not attended.

hook_to_do_deleting($node)

The specified To Do Item ($node) was deleted (i.e. that node does not exist in the database anymore!) You can act on the item and related objects, but you cannot reload it or prevent the deletion.

hook_to_do_finished($node)

The specified To Do Item ($node) was marked with the status Finished.

Note that marking an item as Canceled does not currently generate any callback.

hook_to_do_past_deadline($node)

The specified To Do Item ($node) had to be finished yesterday or earlier.

hook_to_do_reminder($node, $index, $days)

Sending out reminder $index1 for To Do Item $node. This reminder is being sent $days before the deadline.

hook_to_do_started($node)

The specified To Do Item ($node) was marked with the status Started.

Note that saving a To Do Item with the status Started does generate this event each time. You may want to use the

Auto-change "Started" to "In Progress"2 to make sure your users don't save the same item marked Startedover and over again.

hook_to_do_unpublished($node)

The specified To Do item ($node) was unpublished. The item will now be ignored except by the auto-delete feature if it was enabled (see the global settings for more information.)

Usage Example

The to_do/to_do_action.module makes use of all those hooks and transforms them in the appropriate Drupal Core Trigger so one can hook an action to one of those hooks without having to program anything.

This is probably not a perfect example, but it should already give you a good idea of how the interface functions.

Once the to_do/to_do_rules.module is creaed, it will be yet another example of this interface.

  • 1. The reminder $index represents one of the 3 reminders: 0, 1 or 2.
  • 2. See the global settings for more information about the Started to In Progress feature.