You are here

private function EndnoteEncoder::addTitles 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::addTitles()

Add titles to xml.

Parameters

\SimpleXMLElement $xml: Parent XmlElement.

mixed $ref: Our reference.

array $indexes: Mapping indexes.

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

File

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

Class

EndnoteEncoder
Endnote format encoder.

Namespace

Drupal\bibcite_endnote\Encoder

Code

private function addTitles(&$xml, &$ref, $indexes) {
  foreach ($ref as $key => $value) {
    if (array_key_exists($key, $indexes)) {
      $title_key = $indexes[$key];
      switch ($title_key) {
        case 'title':
        case 'secondary-title':
        case 'tertiary-title':
        case 'alt-title':
        case 'short-title':
        case 'translated-title':
          $this
            ->addTag($xml, $key, $value);
          unset($ref[$key]);
          break;
      }
    }
  }
}