Browse Source

initial changes for drupal 9

master
ppound 6 years ago
parent
commit
d341fef4c5
  1. 1
      islandora_herbarium_object.info.yml
  2. 8
      islandora_herbarium_object.module
  3. 7
      src/DataParser/GbifParser.php
  4. 7
      src/DataParser/NrcanParser.php

1
islandora_herbarium_object.info.yml

@ -2,6 +2,7 @@ name: 'Islandora Herbarium Object'
description: 'Provides Islandora Herbarium Object content type and related configuration. Islandora Herbarium Object'
type: module
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- datetime
- field

8
islandora_herbarium_object.module

@ -57,8 +57,8 @@ function islandora_herbarium_object_entity_presave(EntityInterface $entity) {
$geo->updateEntity($entity);
}
catch (Exception $e) {
drupal_set_message(t('There was an error retrieving Geo data. %msg.',
['%msg' => $e->getMessage()]), 'error');
\Drupal::messenger()->addError(t('There was an error retrieving Geo data. %msg.',
['%msg' => $e->getMessage()]));
}
// Get the taxonomy data.
try {
@ -66,8 +66,8 @@ function islandora_herbarium_object_entity_presave(EntityInterface $entity) {
$taxon->updateEntity($entity);
}
catch (Exception $e) {
drupal_set_message(t('There was an error retrieving Taxon data. %msg.',
['%msg' => $e->getMessage()]), 'error');
\Drupal::messenger()->addError(t('There was an error retrieving Taxon data. %msg.',
['%msg' => $e->getMessage()]));
}
$title = $taxon->getValue('canonicalName') . ' - ' . $geo->getValue('name');
if ($title != ' - ') {

7
src/DataParser/GbifParser.php

@ -47,12 +47,7 @@ class GbifParser extends DataParser {
}
catch (Exception $e) {
watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri');
drupal_set_message(t('There was an error retrieving Taxon data. %msg. Verify the url is correct %url',
[
'%msg' => $e->getMessage(),
'%url' => $taxoniri[0]['value'],
]), 'error');
return;
throw ($e);
}
$entity->set('field_dwc_scientificname', $this->getValue('canonicalName'));
$name_arr = explode(' ', $this->getValue('canonicalName'));

7
src/DataParser/NrcanParser.php

@ -50,9 +50,7 @@ class NrcanParser extends DataParser {
}
catch (Exception $e) {
watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri');
drupal_set_message(t('There was an error retrieving Municipality data. %msg. Verify the url is correct %url',
['%msg' => $e->getMessage(), '%url' => $dwciri[0]['value']]), 'error');
return;
throw ($e);
}
$entity->set('field_dwc_municipality', $this->getValue('name'));
// This parser assumes we are in canada.
@ -68,8 +66,7 @@ class NrcanParser extends DataParser {
$province = $p_arr['description'];
}
catch (Exception $e) {
drupal_set_message(t('There was an error retrieving Province data. %msg.',
['%msg' => $e->getMessage()]), 'error');
watchdog_exception('islandora_herbarium_object', $e, 'There was an error retrieving Province data');
}
$entity->set('field_dwc_stateprovince', $province);
$point = [

Loading…
Cancel
Save