eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\PageConverter::generateItemXmlString PHP Method

generateItemXmlString() protected method

Generates XML string for a given $item object.
protected generateItemXmlString ( Item $item, DOMDocument $dom ) : boolean | DOMElement
$item eZ\Publish\Core\FieldType\Page\Parts\Item
$dom DOMDocument
return boolean | DOMElement
    protected function generateItemXmlString(Parts\Item $item, DOMDocument $dom)
    {
        $itemNode = $dom->createElement('item');
        foreach ($item->getState() as $attrName => $attrValue) {
            switch ($attrName) {
                case 'action':
                    if ($attrValue !== null) {
                        $itemNode->setAttribute('action', $attrValue);
                    }
                    break;
                case 'contentId':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'object_id', $attrValue);
                    break;
                case 'locationId':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'node_id', $attrValue);
                    break;
                case 'priority':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'priority', $attrValue);
                    break;
                case 'publicationDate':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_publication', $attrValue);
                    break;
                case 'visibilityDate':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_visible', $attrValue);
                    break;
                case 'hiddenDate':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_hidden', $attrValue);
                    break;
                case 'rotationUntilDate':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'rotation_until', $attrValue);
                    break;
                case 'movedTo':
                    $this->addNewNotEmptyXmlElement($dom, $itemNode, 'moved_to', $attrValue);
                    break;
                case 'attributes':
                    foreach ($attrValue as $arrayItemKey => $arrayItemValue) {
                        $this->addNewNotEmptyXmlElement($dom, $itemNode, $arrayItemKey, $arrayItemValue);
                    }
                    break;
            }
        }
        return $itemNode;
    }