SubmissionNativeXmlFilter::addPubIdentifier PHP Method

addPubIdentifier() public method

Add a single pub ID element for a given plugin to the document.
public addPubIdentifier ( $doc, $submissionNode, $submission, $pubIdPlugin ) : DOMElement | null
$doc DOMDocument
$submissionNode DOMElement
$submission Submission
$pubIdPlugin PubIdPlugin
return DOMElement | null
    function addPubIdentifier($doc, $submissionNode, $submission, $pubIdPlugin)
    {
        $pubId = $submission->getStoredPubId($pubIdPlugin->getPubIdType());
        if ($pubId) {
            $deployment = $this->getDeployment();
            $submissionNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'id', htmlspecialchars($pubId, ENT_COMPAT, 'UTF-8')));
            $node->setAttribute('type', $pubIdPlugin->getPubIdType());
            $node->setAttribute('advice', 'update');
            return $node;
        }
        return null;
    }