You are here

static function Notifications_Template::create_event_template in Notifications 6.3

Create template object for event

3 calls to Notifications_Template::create_event_template()
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_process_build_simple in ./notifications.cron.inc
Creates a single message for a single event
Notifications_Template::get_event_template in classes/notifications_template.class.inc
Get child template object for event

File

classes/notifications_template.class.inc, line 122
Notification Template classes

Class

Notifications_Template
Notifications Template

Code

static function create_event_template($event, $method = NULL, $language = NULL, $module = 'notifications', $parent = NULL) {
  $parts[] = $event->type;
  if (!empty($event->subtype)) {
    $parts[] = $event->subtype;
  }
  $parts[] = $event->action;
  $name = implode('-', $parts);
  if ($template = self::create_template('event', $name, $method, $language, $module, $parent)) {
    $template->event = $event;
    $template->sender = $event->uid;

    // Add event objects and predefined texts to template
    if (!empty($event->objects)) {
      $template->objects = $event->objects;
    }
    $template
      ->set_object('event', $event);
    if (!empty($event->text)) {
      $template->presets = $event->text;
    }
    return $template;
  }
}