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

restoreZoneFromXml() protected method

Restores value for a given Zone $node.
protected restoreZoneFromXml ( DOMElement $node ) : Zone
$node DOMElement
return eZ\Publish\Core\FieldType\Page\Parts\Zone
    protected function restoreZoneFromXml(DOMElement $node)
    {
        $zoneId = null;
        $zoneIdentifier = null;
        $action = null;
        $blocks = array();
        $attributes = array();
        if ($node->hasAttributes()) {
            foreach ($node->attributes as $attr) {
                switch ($attr->name) {
                    case 'id':
                        // Stored Id has following format : id_<zoneId>, so extract <zoneId>
                        $zoneId = substr($attr->value, strpos($attr->value, '_') + 1);
                        break;
                    case 'action':
                        $action = $attr->value;
                        break;
                    default:
                        $attributes[$attr->name] = $attr->value;
                }
            }
        }
        foreach ($node->childNodes as $node) {
            if ($node->nodeType !== XML_ELEMENT_NODE) {
                continue;
            }
            switch ($node->nodeName) {
                case 'block':
                    $block = $this->restoreBlockFromXml($node);
                    $blocks[] = $block;
                    break;
                case 'zone_identifier':
                    $zoneIdentifier = $node->nodeValue;
                    break;
                default:
                    $attributes[$node->nodeName] = $node->nodeValue;
            }
        }
        return new Parts\Zone(array('id' => $zoneId, 'identifier' => $zoneIdentifier, 'attributes' => $attributes, 'action' => $action, 'blocks' => $blocks));
    }