You are here

function notifications_get_templates in Notifications 7

Same name and namespace in other branches
  1. 6.4 includes/templates.inc \notifications_get_templates()

Get notifications templates

Parameters

$op: Operation or type of template information we want 'info', 'parts', 'tokens', 'defaults'

$type: Can be a template key or

  • 'all', to get all
  • 'enabled', to filter out templates for disabled event types
2 calls to notifications_get_templates()
notifications_messaging_templates in includes/templates.inc
Implementation of hook_messaging_templates()
notifications_template_list in ./notifications.admin.inc
Plain list of template names

File

includes/templates.inc, line 18
Notifications templates

Code

function notifications_get_templates($op = 'info', $type = 'all', $language = NULL) {
  static $all_templates;
  switch ($op) {
    case 'info':
      if ($type == 'all' || $type == 'enabled') {
        if (!isset($all_templates)) {
          $all_templates = module_invoke_all('notifications_templates', 'info', 'all');
        }
        if ($type == 'all') {
          return $all_templates;
        }
        elseif ($type == 'enabled') {

          // Get a list of templates for enabled event types
          $enabled = array_filter(notifications_event_type(NULL, 'template'));
          return messaging_template_extract_group($enabled, $all_templates);
        }
      }
      else {
        return module_invoke_all('notifications_templates', 'info', $type, $language);
      }
      break;
    default:
      return module_invoke_all('notifications_templates', $op, $type, $language);
  }
}