It would be nice to have some documentation of any API features.
A subscriptions.api.php file would be good.

Currently there is a docs.php file in the dics directory, however it only contains hook_subscriptions_digest_alter(), which as far as I can tell doesn't exist.

Comments

salvis’s picture

Status: Active » Needs work

I agree.

bulat’s picture

Also it will be good to see hook_subscriptions not only documented, but possibly broken down into several hooks.

I actually was about to start writing subscriptions.api.inc file, but having only hook_subscriptions that does it all makes it a bit pointless.

rooby’s picture

but having only hook_subscriptions that does it all makes it a bit pointless.

Not pointless at all. It's still a hook that needs doco.

More to the point though is that there are more hooks than just hook_subscriptions().

For example, there is also hook_subscriptions_data_alter(), and I'm pretty sure there are more off the top of my head.

bulat’s picture

here is what I have gathered so far:

/**
 * @file
 * Hooks provided by the Subscriptions module.
 */

/**
 * This is sort of a generic hook that is being called in different places 
 * for different purposes from different modules.
 * @param string $op type of the hook (queue, fields, etc.) controls the purpose of the call.
 * 
 * $op = access ?
 * 
 * $op = queue 
 *   $arg0 = event - array that contains event information (e.g. for node creation).
 *   $arg1 - not used
 *   $arg2 - not used
 * 
 * $op = fields
 *   $arg0 = not used
 *   $arg1 - not used
 *   $arg2 - not used
 * 
 * $op = stypes ?
 * $op = stype ?
 * $op = mailkeys - call out of the mailkeys hook implementation
 * @see function subscriptions_mail_mailkeys()
 *
 * $op = mailkey_alter
 *  $arg0 - loaded object
 * 
 * $op = token_types
 * @see function _subscriptions_mail_mail_edit_token_types()
 * 
 */
function hook_subscriptions($op, $arg0 = NULL, $arg1 = NULL, $arg2 = NULL) {

}

/**
 * 
 */
function hook_subscriptions_queue_alter() {
  
}

/**
 * @param array $query 
 */
function hook_subscriptions_queue_query(&$query) {
  
}

/**
 * 
 * @param type $types
 */
function hook_subscriptions_types_alter(&$types) {
  
}

/**
 * 
 * @param type $data
 * @param type $object e.g. $node object
 * @param type $queue_item
 */
function hook_subscriptions_data_alter(&$data, $object, $queue_item) {
  
}

It would be great if somebody with knowledge of the module could fill in the gaps.