' . t('About') . ''; $output .= '
' . t('Islandora Herbarium') . '
'; return $output; default: } } /** * Implements hook_rdf_namespaces(). */ function islandora_herbarium_object_rdf_namespaces() { // Yes, it's amazing, rdf is not registered by default! return [ 'dwc' => 'http://rs.tdwg.org/dwc/terms/', 'dwciri' => 'http://rs.tdwg.org/dwc/iri/', ]; } /** * Implements hook_theme(). */ function islandora_herbarium_object_theme($existing, $type, $theme, $path) { return [ 'fdg_graph' => [ 'variables' => [], ], ]; } /** * Implements hook_entity_presave(). */ function islandora_herbarium_object_entity_presave(EntityInterface $entity) { if ($entity->bundle() == 'islandora_herbarium_object') { // Get the geo data. try { $geo = \Drupal::service('islandora_herbarium_object.geoparser'); $geo->updateEntity($entity); } catch (Exception $e) { \Drupal::messenger()->addError(t('There was an error retrieving Geo data. %msg.', ['%msg' => $e->getMessage()])); } // Get the taxonomy data. try { $taxon = \Drupal::service('islandora_herbarium_object.taxonparser'); $taxon->updateEntity($entity); } catch (Exception $e) { \Drupal::messenger()->addError(t('There was an error retrieving Taxon data. %msg.', ['%msg' => $e->getMessage()])); } $title = $taxon->getValue('canonicalName') . ' - ' . $geo->getValue('name'); if ($title != ' - ') { $entity->setTitle($title); } } }