You are here

function Messaging_Template::add_part in Messaging 6.3

Parameters

$key: Template part key

$default: Default value if key not found

$duplicate: Add duplicates (if this part has been already added)

File

messaging_template/messaging_template.inc, line 274
Base classes for messaging templates

Class

Messaging_Template
Messaging Template class

Code

function add_part($key, $default = NULL, $duplicate = FALSE) {
  if (isset($this->elements[$key]) && !$duplicate) {
    return;
  }
  if (isset($this->presets[$key])) {
    $this
      ->append($this->presets[$key], $key);
  }
  else {

    // Add as Template_Text_Part
    $this
      ->append(new Messaging_Template_Part($this, $key, $default), $key);
  }
}