You are here

static function Notifications_Template::create_template in Notifications 6.3

Create template, just allowed types

We will try to find the following templates in this order module-type-name module-type notifications-type-name notifications-type

Parameters

$type: Template type, currently 'event' or 'digest'

$name: Name prefix for the template, usually related module

$module: Module name. The fallback module will be always 'notifications'

Overrides Messaging_Template_Engine::create_template

4 calls to Notifications_Template::create_template()
notifications_digest_build_long in notifications_digest/notifications_digest.module
Digest multiple events in a single message, long format.
notifications_digest_build_short in notifications_digest/notifications_digest.module
Digest multiple events in a single message, short format.
Notifications_Template::create_event_template in classes/notifications_template.class.inc
Create template object for event
Notifications_Template::get_template in classes/notifications_template.class.inc
Get child template from template engine

File

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

Class

Notifications_Template
Notifications Template

Code

static function create_template($type, $name = NULL, $method = NULL, $language = NULL, $module = 'notifications', $parent = NULL) {

  // We try first with name and then without
  if ($name && self::get_info($module . '-' . $type . '-' . $name)) {
    return new Notifications_Template($module . '-' . $type . '-' . $name, $parent, $method, $language, $module);
  }
  elseif (self::get_info($module . '-' . $type)) {
    return new Notifications_Template($module . '-' . $type, $parent, $method, $language, $module);
  }
  elseif ($module != 'notifications') {

    // We retry for module = notifications, still we fix the module in the resulting template
    if ($template = self::create_template($type, $name, $method, $language, 'notifications', $parent)) {
      $template->module = $module;
      return $template;
    }
  }
}