You are here

public function BiblioMigrateContributorCollections::prepare in Bibliography Module 7.3

File

includes/migrate/7300/biblio_contributor_collections.migrate.inc, line 57

Class

BiblioMigrateContributorCollections
@file

Code

public function prepare($entity, $row) {

  // Replace the role name with its term ID.
  $name = $row->role;
  if ($term = taxonomy_get_term_by_name($name, 'biblio_roles')) {
    $term = reset($term);
  }
  else {
    $term = (object) array(
      'name' => $name,
      'vid' => $this->roles_vocabulary->vid,
    );
    taxonomy_term_save($term);
  }
  $wrapper = entity_metadata_wrapper('field_collection_item', $entity);
  $wrapper->biblio_contributor_role
    ->set($term->tid);
}