public static function Notifications_Event::create in Notifications 6.4
Build new event object from array of data
Replaces notifications_event_build()
Parameters
$params: Event properties
$objects: Array of event objects (type => $object)
3 calls to Notifications_Event::create()
- notifications_content_test_template_submit in notifications_content/
notifications_content.pages.inc - Process template test
- notifications_event in ./
notifications.module - Pass on event to queue processing and run it to the end
- notifications_lite_add_to_queue in notifications_lite/
notifications_lite.module - Put simple notification into queue
File
- includes/
notifications_event.class.inc, line 317 - Drupal Notifications Framework - Default class file
Class
- Notifications_Event
- Message destination class
Code
public static function create($params, $objects = array()) {
global $user, $language;
// Fill in event with default values
$params += array(
'uid' => $user->uid,
'language' => $language->language,
'type' => 'default',
// Object/event type
'action' => 'default',
);
$params += array(
'typekey' => $params['type'] . '-' . $params['action'],
);
// Check whether we have to save and queue this event, defaults to yes if not set
// If not enabled, do not store nor queue this event, can be changed by plug-in modules
$enabled = notifications_event_enabled($params['typekey']);
$params += array(
'save' => $enabled,
'queue' => $enabled,
);
$event = new Notifications_Event($params);
foreach ($objects as $type => $object) {
$event
->add_object($type, $object);
}
// Modules can do cleanup operations or modify event properties
module_invoke_all('notifications_event', 'build', $event);
return $event;
}