public function renderAuthor(array $authors)
 {
     $output = [];
     $separator = ' & ';
     $format = AuthorFormatter::SEQ_FAMILY_COMMA_GIVEN | AuthorFormatter::GIVEN_NAME_SECOND | AuthorFormatter::GIVEN_NAME_ABBR_ALL | AuthorFormatter::ALTERNATIVE_NAMES_SUPPRESS | AuthorFormatter::CAPITALIZATION_NORMAL;
     $formatter = new AuthorFormatter($format);
     foreach ($authors as $a) {
         $author = new Author(['givenName' => $a->given, 'familyName' => $a->family]);
         $output[] = $author->format($formatter);
     }
     return Html::encode(implode($separator, $output));
 }
Beispiel #2
0
 /**
  * Renders author component
  *
  * @return string
  */
 function render()
 {
     $authors = empty($this->reference->{'author'}) ? [] : $this->reference->{'author'};
     if (empty($authors)) {
         return 'S.a.';
     }
     $output = [];
     $separator = ' & ';
     $format = AuthorFormatter::SEQ_FAMILY_COMMA_GIVEN | AuthorFormatter::GIVEN_NAME_SECOND | AuthorFormatter::GIVEN_NAME_ABBR_ALL | AuthorFormatter::ALTERNATIVE_NAMES_SUPPRESS | AuthorFormatter::CAPITALIZATION_NORMAL;
     $formatter = new AuthorFormatter($format);
     foreach ($authors as $a) {
         $author = new AuthorNormalizer(['givenName' => $a->given, 'familyName' => $a->family]);
         $output[] = $author->format($formatter);
     }
     return implode($separator, $output);
 }