ArticleMedraXmlFilter::createContributorNode PHP Method

createContributorNode() public method

Create a contributor node.
public createContributorNode ( $doc, $author, $objectLocalePrecedence ) : DOMElement
$doc DOMDocument
$author Author
$objectLocalePrecedence array
return DOMElement
    function createContributorNode($doc, $author, $objectLocalePrecedence)
    {
        $deployment = $this->getDeployment();
        $contributorNode = $doc->createElementNS($deployment->getNamespace(), 'Contributor');
        // Sequence number
        $seq = $author->getSequence();
        assert(!empty($seq));
        $contributorNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'SequenceNumber', $seq));
        // Contributor role (mandatory)
        $contributorNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'ContributorRole', O4DOI_CONTRIBUTOR_ROLE_ACTUAL_AUTHOR));
        // Person name (mandatory)
        $personName = $author->getFullName();
        assert(!empty($personName));
        $contributorNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'PersonName', htmlspecialchars($personName, ENT_COMPAT, 'UTF-8')));
        // Inverted person name
        $invertedPersonName = $author->getFullName(true);
        assert(!empty($invertedPersonName));
        $contributorNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'PersonNameInverted', htmlspecialchars($invertedPersonName, ENT_COMPAT, 'UTF-8')));
        // Affiliation
        $affiliation = $this->getPrimaryTranslation($author->getAffiliation(null), $objectLocalePrecedence);
        if (!empty($affiliation)) {
            $affiliationNode = $doc->createElementNS($deployment->getNamespace(), 'ProfessionalAffiliation');
            $affiliationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'Affiliation', htmlspecialchars($affiliation, ENT_COMPAT, 'UTF-8')));
            $contributorNode->appendChild($affiliationNode);
        }
        // Biographical note
        $bioNote = $this->getPrimaryTranslation($author->getBiography(null), $objectLocalePrecedence);
        if (!empty($bioNote)) {
            $contributorNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'BiographicalNote', htmlspecialchars(PKPString::html2text($bioNote), ENT_COMPAT, 'UTF-8')));
        }
        return $contributorNode;
    }