function notifications_ui_notifications in Notifications 6
Same name and namespace in other branches
- 5 notifications_ui/notifications_ui.module \notifications_ui_notifications()
- 6.2 notifications_ui/notifications_ui.module \notifications_ui_notifications()
- 6.3 notifications_ui/notifications_ui.module \notifications_ui_notifications()
- 7 notifications_ui/notifications_ui.module \notifications_ui_notifications()
Implementation of hook_notifications.
File
- notifications_ui/
notifications_ui.module, line 108 - User Interface for subscriptions modules
Code
function notifications_ui_notifications($op, $arg0, $arg1 = NULL, $arg2 = NULL) {
if ($op == 'event trigger') {
$event = $arg0;
if ($event->type == 'node' && isset($event->node->subscriptions)) {
if ($event->action == 'insert') {
// On insert some field information will be missing, we need to recreate it.
foreach ($event->node->subscriptions['params'] as $i => $subscriptions) {
foreach ($subscriptions['fields'] as $key => $value) {
if (!$value && isset($event->params[$key])) {
$event->node->subscriptions['params'][$i]['fields'][$key] = $event->params[$key];
}
}
}
}
$form_state['values']['subscriptions'] = $event->node->subscriptions;
notifications_ui_options_form_submit('', $form_state);
}
elseif ($event->type == 'node' && isset($event->comment->subscriptions)) {
$form_state['values']['subscriptions'] = $event->comment->subscriptions;
notifications_ui_options_form_submit('', $form_state);
}
}
}