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;
}