You are here

public function csl_element::set_attributes in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/CSL.inc \csl_element::set_attributes()
  2. 7.2 modules/CiteProc/CSL.inc \csl_element::set_attributes()
2 calls to csl_element::set_attributes()
csl_element::__construct in modules/CiteProc/CSL.inc
csl_style::__construct in modules/CiteProc/CSL.inc

File

modules/CiteProc/CSL.inc, line 267
CiteProc-PHP.

Class

csl_element

Code

public function set_attributes($dom_node) {
  $att = array();
  $element_name = $dom_node->nodeName;
  if (isset($dom_node->attributes->length)) {
    for ($i = 0; $i < $dom_node->attributes->length; $i++) {
      $value = $dom_node->attributes
        ->item($i)->value;
      $name = str_replace(' ', '_', $dom_node->attributes
        ->item($i)->name);
      if ($name == 'type') {
        $value = $this->citeproc
          ->map_type($value);
      }
      if (($name == 'variable' || $name == 'is-numeric') && $element_name != 'label') {
        $value = $this->citeproc
          ->map_field($value);
      }
      $this->{$name} = $value;
    }
  }
}