You are here

function Messaging_Template::append in Messaging 6.3

Append element: may be a text or another template

2 calls to Messaging_Template::append()
Messaging_Template::add_child in messaging_template/messaging_template.inc
Messaging_Template::add_part in messaging_template/messaging_template.inc

File

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

Class

Messaging_Template
Messaging Template class

Code

function append($value, $key = NULL) {
  if (!isset($key)) {
    $this->elements[] = $value;
  }
  elseif (isset($this->elements[$key])) {

    // If not an array yet, make it into an array
    if (!is_array($this->elements[$key])) {
      $this->elements[$key] = array(
        $this->elements[$key],
      );
    }
    $this->elements[$key][] = $value;
  }
  else {
    $this->elements[$key] = $value;
  }
}