From 4fc8661a00750c56866c3632d2f284628c605a1e Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 19 Jan 2022 16:24:05 +0100 Subject: [PATCH] DoiController.php: also update zpdate() method for setting correct alternateIdentifier --- .../Controllers/Publish/DoiController.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/Http/Controllers/Publish/DoiController.php b/app/Http/Controllers/Publish/DoiController.php index 97c0ac4..a24f350 100644 --- a/app/Http/Controllers/Publish/DoiController.php +++ b/app/Http/Controllers/Publish/DoiController.php @@ -217,6 +217,7 @@ class DoiController extends Controller $cache = ($dataset->xmlCache) ? $dataset->xmlCache : new \App\Models\XmlCache(); $xmlModel->setXmlCache($cache); $domNode = $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0); + $this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id); $node = $this->xml->importNode($domNode, true); $this->addSpecInformation($node, 'data-type:' . $dataset->type); @@ -261,6 +262,24 @@ class DoiController extends Controller } } + /** + * Add the landingpage attribute to Rdr_Dataset XML output. + * + * @param \DOMNode $document Rdr_Dataset XML serialisation + * @param string $docid Id of the dataset + * @return void + */ + private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid) + { + $base_domain = config('tethys.base_domain'); + $url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid; + + $owner = $document->ownerDocument; + $attr = $owner->createAttribute('landingpage'); + $attr->appendChild($owner->createTextNode($url)); + $document->appendChild($attr); + } + /** * Remove the specified resource from storage. *