Template::setFields - jcobban/Genealogy GitHub Wiki

$template->setFields($array)

Up: class Template

This method accepts an associative array or an instance of class Record to set replacement values for multiple markers. This method is equivalent to calling $template‑>set($marker, $value, false) for each element of the array or each field in the instance of class Record.

This method has one parameter:

parameter description
$array an associative array defining multiple marker/value pairs or an instance of class Record.

For example:

$person	= new Person($parms);
$person['special']	= 'special';
$template->setFields($person);

initializes substitutions for every field in the object as well as the temporary field name "special". It exists primarily because the function was already defined in the original implementation of Template that was used as the basis for this implementation, although in fact there was a bug in the method $template->setFields in that original implementation. For most of the situations where you would be tempted to use this method it is recommended to use $template['id']->update($record) or $templateTag‑>update($record) because with TemplateTag::update the substitution name match ignores the case.

Next: $template->updateTag($elementid, $modifier)