You are here

private function EndnoteEncoder::addDates in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_endnote/src/Encoder/EndnoteEncoder.php \Drupal\bibcite_endnote\Encoder\EndnoteEncoder::addDates()

Add dates to xml.

Parameters

\SimpleXMLElement $xml: Parent XmlElement.

mixed $ref: Our reference.

array $indexes: Mapping indexes.

string $pub_key: Key for pub-date.

1 call to EndnoteEncoder::addDates()
EndnoteEncoder::encode in modules/bibcite_endnote/src/Encoder/EndnoteEncoder.php

File

modules/bibcite_endnote/src/Encoder/EndnoteEncoder.php, line 325

Class

EndnoteEncoder
Endnote format encoder.

Namespace

Drupal\bibcite_endnote\Encoder

Code

private function addDates(&$xml, &$ref, $indexes, $pub_key) {
  foreach ($ref as $key => $value) {
    switch ($key) {
      case 'date':
        $date = $xml
          ->addChild($pub_key);
        $this
          ->addTag($date, $key, $value);
        unset($ref[$key]);
        break;
      case 'year':
        $this
          ->addTag($xml, $key, $value);
        unset($ref[$key]);
        break;
    }
  }
}