Sulu\Component\Content\Metadata\Loader\XmlLegacyLoader::loadStructureTags PHP Method

loadStructureTags() private method

Loads the tags for the structure.
private loadStructureTags ( $path, $xpath ) : array
$path
$xpath
return array
    private function loadStructureTags($path, $xpath)
    {
        $result = [];
        foreach ($xpath->query($path) as $node) {
            $tag = ['name' => null, 'attributes' => []];
            foreach ($node->attributes as $key => $attr) {
                if (in_array($key, ['name'])) {
                    $tag[$key] = $attr->value;
                } else {
                    $tag['attributes'][$key] = $attr->value;
                }
            }
            if (!isset($tag['name'])) {
                // this should not happen because of the XSD validation
                throw new \InvalidArgumentException('Tag does not have a name in template definition');
            }
            $result[] = $tag;
        }
        return $result;
    }