You are here

function messaging_template_info in Messaging 6.3

Returns information about message template groups, always in default language

Was: messaging_message_group()

Parameters

$name: Optional message group. Returns all groups if null.

$key: Optional message key inside the group. Returns all keys if null.

Return value

array() Depending on parameters, may be all message groups and keys or only a specific one.

8 calls to messaging_template_info()
messaging_template_admin_description in messaging_template/messaging_template.admin.inc
Build template description
messaging_template_admin_edit in messaging_template/messaging_template.admin.inc
Message groups edit page
messaging_template_admin_overview in messaging_template/messaging_template.admin.inc
messaging_template_admin_settings in messaging_template/messaging_template.admin.inc
Template settings: enable/disable, fallback, etc...
messaging_template_edit_form in messaging_template/messaging_template.admin.inc
Edit message formats

... See full list

File

messaging_template/messaging_template.module, line 109
Template system for Messaging Framework

Code

function messaging_template_info($name = NULL, $key = NULL) {
  static $info;
  if (!isset($info)) {
    $info = array();
    $result = db_query('SELECT * FROM {messaging_template}');
    while ($data = db_fetch_array($result)) {
      $info[$data['name']] = $data;
    }

    // Add module info and create when missing
    $module_info = messaging_template_invoke_all('templates');
    foreach ($module_info as $type => $data) {
      if (isset($info[$type])) {
        $info[$type] = array_merge($data, $info[$type]);
      }
      else {
        $data['name'] = $type;
        $data['enabled'] = empty($data['disabled']);
        drupal_write_record('messaging_template', $data);
        $info[$type] = $data;
      }
    }
  }
  return _messaging_info($info, $name, $key);
}