You are here

function biblio_get_contributors in Bibliography Module 7.2

Extracts Contributor data from a Biblio entity and lists contributors together in an array.

Parameters

[type] $biblio [description]:

Return value

[type] [description]

2 calls to biblio_get_contributors()
biblio_contributor_widget in ./biblio.module
Get form structure for the multivalued add contributor widget
_biblio_bibtex_export in modules/bibtexParse/biblio_bibtex.module
Export data in bibtex format.

File

includes/biblio.contributors.inc, line 513

Code

function biblio_get_contributors($biblio) {
  $wrapper = biblio_wrapper($biblio, 'biblio');
  $categories = biblio_contributor_categories();
  $contributors = array();
  foreach ($categories as $category => $info) {

    // biblio_primary_contributors, biblio_secondary_contributors, etc...
    $field = $info['field'];
    foreach ($wrapper->{$field}
      ->value() as $delta => $contributor) {

      // If the contributor entity has not been deleted
      if ($contributor) {
        $cid = $wrapper->{$field}[$delta]->cid
          ->value();
        if (isset($cid) && !empty($cid)) {
          $contributors[$cid]['name'] = $wrapper->{$field}[$delta]->biblio_contributor_name
            ->value();
          $contributors[$cid]['category'] = $category;
        }
      }
    }
  }
  return $contributors;
}