eZ\Publish\Core\FieldType\Page\HashConverter::convertZoneToHash PHP Method

convertZoneToHash() protected method

Converts the given $zone into a plain hash format.
protected convertZoneToHash ( Zone $zone ) : array
$zone eZ\Publish\Core\FieldType\Page\Parts\Zone
return array
    protected function convertZoneToHash(Zone $zone)
    {
        $hash = array();
        foreach ($zone->getState() as $propName => $propValue) {
            switch ($propName) {
                case 'id':
                case 'identifier':
                case 'action':
                    if ($propValue !== null) {
                        $hash[$propName] = $propValue;
                    }
                    break;
                case 'attributes':
                    if ($propValue !== null && $propValue !== array()) {
                        $hash['attributes'] = $propValue;
                    }
                    break;
                case 'blocks':
                    foreach ($propValue as $block) {
                        $hash['blocks'][] = $this->convertBlockToHash($block);
                    }
                    break;
            }
        }
        return $hash;
    }