You are here

function biblio_pm_field_create_instance in Bibliography Module 7.2

Implements hook_field_create_instance().

File

modules/pubmed/biblio_pm.module, line 405

Code

function biblio_pm_field_create_instance($instance) {
  if ($instance['entity_type'] != 'biblio') {
    return;
  }
  $pubtype = $instance['bundle'];
  $field_name = 'biblio_pmid';
  $instance_info = field_info_instance('biblio', $field_name, $pubtype);

  // If biblio_pmid field exists, but no instances exist for current pubtype
  if (field_info_field($field_name) && !$instance_info) {
    $instance = biblio_pm_default_instance_info($pubtype);
    field_create_instance($instance);
  }
}