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

generateZoneXmlString() protected method

Generates XML string for a given $zone object.
protected generateZoneXmlString ( Zone $zone, DOMDocument $dom ) : DOMElement
$zone eZ\Publish\Core\FieldType\Page\Parts\Zone
$dom DOMDocument
return DOMElement
    protected function generateZoneXmlString(Parts\Zone $zone, DOMDocument $dom)
    {
        $zoneNode = $dom->createElement('zone');
        foreach ($zone->getState() as $attrName => $attrValue) {
            switch ($attrName) {
                case 'id':
                    $zoneNode->setAttribute('id', 'id_' . $attrValue);
                    break;
                case 'action':
                    if ($attrValue !== null) {
                        $zoneNode->setAttribute('action', $attrValue);
                    }
                    break;
                case 'identifier':
                    $this->addNewXmlElement($dom, $zoneNode, 'zone_identifier', $attrValue);
                    break;
                case 'blocks':
                    foreach ($zone->{$attrName} as $block) {
                        $zoneNode->appendChild($this->generateBlockXmlString($block, $dom));
                    }
                    break;
                case 'attributes':
                    foreach ($attrValue as $arrayItemKey => $arrayItemValue) {
                        $this->addNewXmlElement($dom, $zoneNode, $arrayItemKey, $arrayItemValue);
                    }
                    break;
                case 'blocksById':
                    // Do not store
                    break;
                default:
                    $this->addNewNotEmptyXmlElement($dom, $zoneNode, $attrName, $attrValue);
                    break;
            }
        }
        return $zoneNode;
    }