eZ\Publish\Core\FieldType\Image\ImageStorage\Gateway\LegacyStorage::extractFilesFromXml PHP Method

extractFilesFromXml() public method

public extractFilesFromXml ( $xml )
    public function extractFilesFromXml($xml)
    {
        if (empty($xml)) {
            // Empty image value
            return null;
        }
        $files = array();
        $dom = new \DOMDocument();
        $dom->loadXml($xml);
        if ($dom->documentElement->hasAttribute('dirpath')) {
            $url = $dom->documentElement->getAttribute('url');
            if (empty($url)) {
                return null;
            }
            $files['original'] = $this->redecorator->redecorateFromTarget($url);
            /** @var \DOMNode $childNode */
            foreach ($dom->documentElement->childNodes as $childNode) {
                if ($childNode->nodeName != 'alias') {
                    continue;
                }
                $files[$childNode->getAttribute('name')] = $this->redecorator->redecorateFromTarget($childNode->getAttribute('url'));
            }
            return $files;
        }
        return null;
    }