You are here

function csl_names::init in Bibliography Module 6.2

Same name and namespace in other branches
  1. 7 modules/CiteProc/CSL.inc \csl_names::init()
  2. 7.2 modules/CiteProc/CSL.inc \csl_names::init()

Overrides csl_element::init

File

modules/CiteProc/CSL.inc, line 803

Class

csl_names

Code

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);
    }
  }
}