parseTranslatableElement example



            // elements             if ($name = $item->getElementsByTagName('name')->item(0)) {
                $element['name'] = $name->nodeValue;
            }

            if ($item->getElementsByTagName('value')->length) {
                $element['value'] = XmlUtils::phpize($item->getElementsByTagName('value')->item(0)->nodeValue);
            }

            $element['label'] = self::parseTranslatableElement($item, 'label');
            $element['description'] = self::parseTranslatableElement($item, 'description');

            $element['options'] = [];
            if ($options = self::parseOptionsNodeList(
                $item->getElementsByTagName('options')
            )) {
                $element['options'] = $options;
            }

            if ($store = self::parseStoreNodeList(
                $item->getElementsByTagName('store')
            ))


        return $menu;
    }

    private function parseEntry(DOMElement $entry): array
    {
        $menuEntry = [];

        $menuEntry['isRootMenu'] = self::validateBooleanAttribute($entry->getAttribute('isRootMenu'));

        $label = self::parseTranslatableElement($entry, 'label');

        if ($label !== null) {
            $menuEntry['label'] = $label;
        }

        foreach (['name', 'controller', 'action', 'class', 'onclick'] as $simpleField) {
            $fieldValue = self::getElementChildValueByName($entry$simpleField);
            if ($fieldValue !== null) {
                $menuEntry[$simpleField] = $fieldValue;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.