|
|
|
|
@ -38,16 +38,17 @@ function islandora_herbarium_object_entity_presave(Drupal\Core\Entity\EntityInte
|
|
|
|
|
$geo->parseData(); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri'); |
|
|
|
|
//todo drupal_set_message |
|
|
|
|
drupal_set_message(t('There was an error retrieving Municipality data. %msg. Verify the url is correct %ulr', |
|
|
|
|
array('%msg'=> $e->getMessage(), '%url' => $dwciri[0]['value'])), 'error'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
$entity->set('field_dwc_municipality', $geo->data_arr['name']); |
|
|
|
|
$entity->set('field_dwc_countrycode', $geo->data_arr['countryCode']); |
|
|
|
|
$entity->set('field_dwc_country', $geo->data_arr['countryName']); |
|
|
|
|
$entity->set('field_dwc_continent', $geo->data_arr['countinentCode']); |
|
|
|
|
$entity->set('field_dwc_decimallatitude', $geo->data_arr['lat']); |
|
|
|
|
$entity->set('field_dwc_decimallongitude', $geo->data_arr['lng']); |
|
|
|
|
$entity->set('field_dwc_stateprovince', $geo->data_arr['adminName1']); |
|
|
|
|
$entity->set('field_dwc_municipality', $geo->getValue('name')); |
|
|
|
|
$entity->set('field_dwc_countrycode', $geo->getValue('countryCode')); |
|
|
|
|
$entity->set('field_dwc_country', $geo->getValue('countryName')); |
|
|
|
|
$entity->set('field_dwc_continent', $geo->getValue('countinentCode')); |
|
|
|
|
$entity->set('field_dwc_decimallatitude', $geo->getValue('lat')); |
|
|
|
|
$entity->set('field_dwc_decimallongitude', $geo->getValue('lng')); |
|
|
|
|
$entity->set('field_dwc_stateprovince', $geo->getValue('adminName1')); |
|
|
|
|
$point = array( |
|
|
|
|
'lon' => $geo->data_arr['lng'], |
|
|
|
|
'lat' => $geo->data_arr['lat'], |
|
|
|
|
@ -62,17 +63,27 @@ function islandora_herbarium_object_entity_presave(Drupal\Core\Entity\EntityInte
|
|
|
|
|
$taxon->parseData(); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri'); |
|
|
|
|
//todo drupal_set_message |
|
|
|
|
drupal_set_message(t('There was an error retrieving Taxon data. %msg. Verify the url is correct %url', |
|
|
|
|
array('%msg'=> $e->getMessage(), '%url' => $taxoniri[0]['value'])),'error'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
$entity->set('field_dwc_scientificname', $taxon->data_arr['nameComplete']); |
|
|
|
|
$entity->set('field_dwc_specificepithet', $taxon->data_arr['specificEpithet']); |
|
|
|
|
$entity->set('field_dwc_genus', $taxon->data_arr['genusPart']); |
|
|
|
|
// todo translate |
|
|
|
|
$title = $taxon->data_arr['nameComplete'] . ' - ' . $geo->data_arr['name']; |
|
|
|
|
$entity->set('field_dwc_scientificname', $taxon->getValue('canonicalName')); |
|
|
|
|
$name_arr = explode(' ', $taxon->getValue('canonicalName')); |
|
|
|
|
$entity->set('field_dwc_specificepithet', $name_arr[1]); |
|
|
|
|
$entity->set('field_dwc_kingdom', $taxon->getValue('kingdom')); |
|
|
|
|
$entity->set('field_dwc_genus', $taxon->getValue('genus')); |
|
|
|
|
$entity->set('field_dwc_phylum', $taxon->getValue('phylum')); |
|
|
|
|
$entity->set('field_dwc_order', $taxon->getValue('order')); |
|
|
|
|
$entity->set('field_dwc_family', $taxon->getValue('family')); |
|
|
|
|
$entity->set('field_dwc_vernacularname', $taxon->getValue('vernacularName')); |
|
|
|
|
|
|
|
|
|
$title = $taxon->getValue('canonicalName') . ' - ' . $geo->getValue('name'); |
|
|
|
|
if(!empty($title)) { |
|
|
|
|
$entity->setTitle( $taxon->data_arr['nameComplete'] . ' - ' . $geo->data_arr['name']); |
|
|
|
|
$entity->setTitle($title); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|