function notifications_nodetype_notifications in Notifications 6.4
Implementation of hook_notifications()
File
- notifications_nodetype/
notifications_nodetype.module, line 27 - Notifications content type extension
Code
function notifications_nodetype_notifications($op, $event = NULL, $arg1 = NULL, $arg2 = NULL) {
switch ($op) {
case 'event types':
// Creates a new one for each content type x node event types
// @see notifications_content_notifications()
$types = array();
foreach (node_get_types() as $type => $info) {
// Don't provide more options for content types that are disabled, we don't want to mess up everything
if (notifications_content_type_enabled($type, NULL)) {
// Node inserts are not grouped by node but all together. The digest will look like:
// New content has been submitted
// - Story Title1 by Author1
// - Event Title2 by Author2
$variables = array(
'@name' => $info->name,
);
$prefix = 'node-' . $type;
$template = 'notifications-content-' . $type;
$types[$prefix . '-insert'] = array(
'type' => 'node',
'action' => 'insert',
'name' => t('A new @name has been submitted', $variables),
'line' => t('@name: [title] by [author-name]', $variables),
'digest' => array(
'node',
'type',
),
'description' => t('Create @name', $variables),
'template' => $template . '-insert',
'parent' => 'node-insert',
);
// These other events are grouped for each node. The digest will look like:
// Story: Title of the story
// - The story has been updated
// - New comment by User: Comment title
$types[$prefix . '-update'] = array(
'type' => 'node',
'action' => 'update',
'name' => t('Update for @name: [title]', $variables),
'line' => t('The @name has been updated', $variables),
'digest' => array(
'node',
'nid',
),
'description' => t('Update @name', $variables),
'template' => $template . '-update',
'parent' => 'node-update',
);
$types[$prefix . '-comment'] = array(
'type' => 'node',
'action' => 'comment',
'name' => t('Comment for @name: [title]', $variables),
'line' => t('New comment by [comment-author-name]: [comment-title]'),
'digest' => array(
'node',
'nid',
),
'description' => t('New comment for @name', $variables),
'template' => $template . '-comment',
'parent' => 'node-comment',
);
}
}
return $types;
}
}