You are here

public function BiblioStyleEndNoteTagged::renderEntryContributors in Bibliography Module 7.3

File

plugins/biblio_style/endnote/BiblioStyleEndNoteTagged.php, line 149
EndNote tagged biblio style.

Class

BiblioStyleEndNoteTagged
@file EndNote tagged biblio style.

Code

public function renderEntryContributors(&$output = array(), EntityMetadataWrapper $wrapper) {
  if (!($values = $wrapper->contributor_field_collection
    ->value())) {
    return;
  }
  $contrib_map = array();

  // Normalize map, to get array keyed by Biblio role and the EndNote tag as
  // the value.
  $map = $this
    ->getMapping();
  foreach ($map['field'] as $tag => $tag_info) {
    if ($tag_info['render_method'] != 'renderEntryContributors') {
      continue;
    }
    $role = $tag_info['role'];
    $contrib_map[$role] = $tag;
  }
  foreach ($wrapper->contributor_field_collection as $sub_wrapper) {
    $role = $sub_wrapper->biblio_contributor_role
      ->label();
    $contributor = $sub_wrapper->biblio_contributor
      ->value();

    // If we can't map the type, assume it is an author.
    // @todo: Is this right?
    $tag = !empty($contrib_map[$role]) ? $contrib_map[$role] : '%A';
    $output[] = $tag . ' ' . $contributor->name;
  }
}