public function csl_names::init in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_names::init()
- 7.2 modules/CiteProc/CSL.inc \csl_names::init()
Overrides csl_element::init
File
- modules/
CiteProc/ CSL.inc, line 1015 - CiteProc-PHP.
Class
Code
public function init($dom_node, $citeproc) {
$etal = '';
$tag = $dom_node
->getElementsByTagName('substitute')
->item(0);
if ($tag) {
$this->substitutes = csl_factory::create($tag, $citeproc);
$dom_node
->removeChild($tag);
}
$tag = $dom_node
->getElementsByTagName('et-al')
->item(0);
if ($tag) {
$etal = csl_factory::create($tag, $citeproc);
$dom_node
->removeChild($tag);
}
$var = $dom_node
->getAttribute('variable');
foreach ($dom_node->childNodes as $node) {
if ($node->nodeType == 1) {
$element = csl_factory::create($node, $citeproc);
if ($element instanceof csl_label) {
$element->variable = $var;
}
if ($element instanceof csl_name && $etal) {
$element->etal = $etal;
}
$this
->add_element($element);
}
}
}