RepresentationNativeXmlFilter::addIdentifiers PHP Method

addIdentifiers() public method

Create and add identifier nodes to a representation node.
public addIdentifiers ( $doc, $representationNode, $representation )
$doc DOMDocument
$representationNode DOMElement
$representation Representation
    function addIdentifiers($doc, $representationNode, $representation)
    {
        $deployment = $this->getDeployment();
        // Add internal ID
        $representationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'id', $representation->getId()));
        $node->setAttribute('type', 'internal');
        $node->setAttribute('advice', 'ignore');
        // Add public ID
        if ($pubId = $representation->getStoredPubId('publisher-id')) {
            $representationNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'id', htmlspecialchars($pubId, ENT_COMPAT, 'UTF-8')));
            $node->setAttribute('type', 'public');
            $node->setAttribute('advice', 'update');
        }
        // Add pub IDs by plugin
        $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $deployment->getContext()->getId());
        foreach ((array) $pubIdPlugins as $pubIdPlugin) {
            $this->addPubIdentifier($doc, $representationNode, $representation, $pubIdPlugin);
        }
    }