Make element item
@param int    $iElementID
@param \Model $obElement

@return \Lovata\Toolbox\Classes\Item\ElementItem
482736
protected function makeItem($iElementID, $obElement = null)
    {
        $sItemClass = static::ITEM_CLASS;

        return $sItemClass::make($iElementID, $obElement);
    }
1366555
public function formTextarea(IElement $element)
    {
        $attributes = $this->buildAttributes($element->getAttributes());

        return '<textarea ' . $attributes . '>' . $element->getValue() . '</textarea>';
    }
556538
protected function configureEollection(
        CollectionElementInterface $element,
        array $spec = []
    ): CollectionElementInterface {

        if (isset($spec['elements']) && is_array($spec['elements'])) {
            $element->withElement(...$this->createMultiple($spec['elements']));
        }

        return $element;
    }
557416
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(EntityAttributes::NS, 'mdattr:EntityAttributes');
        $parent->appendChild($e);

        /** @var \SAML2\XML\saml\Attribute|\SAML2\XML\Chunk $child */
        foreach ($this->children as $child) {
            $child->toXML($e);
        }

        return $e;
    }
990708
public static function copyElement(DOMElement $element, DOMElement $parent = null) : DOMElement
    {
        if ($parent === null) {
            $document = DOMDocumentFactory::create();
        } else {
            $document = $parent->ownerDocument;
        }

        $namespaces = [];
        for ($e = $element; $e instanceof DOMNode; $e = $e->parentNode) {
            foreach (Utils::xpQuery($e, './namespace::*') as $ns) {
                $prefix = $ns->localName;
                if ($prefix === 'xml' || $prefix === 'xmlns') {
                    continue;
                }
                $uri = $ns->nodeValue;
                if (!isset($namespaces[$prefix])) {
                    $namespaces[$prefix] = $uri;
                }
            }
        }

        /** @var \DOMElement $newElement */
        $newElement = $document->importNode($element, true);
        if ($parent !== null) {
            /* We need to append the child to the parent before we add the namespaces. */
            $parent->appendChild($newElement);
        }

        foreach ($namespaces as $prefix => $uri) {
            $newElement->setAttributeNS($uri, $prefix.':__ns_workaround__', 'tmp');
            $newElement->removeAttributeNS($uri, '__ns_workaround__');
        }

        return $newElement;
    }
504972
protected function wrap(\DOMElement $element, $html)
    {
        $wrapper = $element->ownerDocument->createDocumentFragment();
        $wrapper->appendXML($html);

        $result = $wrapper->firstChild;
        $element->parentNode->appendChild($wrapper);

        $xpath = new \DOMXpath($element->ownerDocument);
        $targets = $xpath->query('//inky-content', $wrapper);

        if ($targets->length) {
            $parent = $targets->item(0)->parentNode;
            $parent->removeChild($targets->item(0));
            $parent->appendChild($element);
        }

        return $result;
    }
889951
protected function addClass(\DOMElement $element, $class)
    {
        if ($element->hasAttribute('class')) {
            $element->setAttribute('class', $element->getAttribute('class') . ' ' . $class);
        } else {
            $element->setAttribute('class', $class);
        }
    }
689794
public function createOrderElement(BasketElementInterface $basketElement, $format = 'json')
    {
        /** @var OrderElementInterface $orderElement */
        $orderElement = new $this->orderElementClassName();
        $orderElement->setQuantity($basketElement->getQuantity());
        $orderElement->setUnitPriceExcl($basketElement->getUnitPrice(false));
        $orderElement->setUnitPriceInc($basketElement->getUnitPrice(true));
        $orderElement->setPrice($basketElement->getPrice(true));
        $orderElement->setVatRate($basketElement->getVatRate());
        $orderElement->setDesignation($basketElement->getName());
        $orderElement->setProductType($this->getCode());
        $orderElement->setStatus(OrderInterface::STATUS_PENDING);
        $orderElement->setDeliveryStatus(ServiceDeliveryInterface::STATUS_OPEN);
        $orderElement->setCreatedAt(new \DateTime());
        $orderElement->setOptions($basketElement->getOptions());

        $product = $basketElement->getProduct();
        $orderElement->setDescription($product->getDescription());
        $orderElement->setProductId($product->getId());
        $orderElement->setRawProduct($this->getRawProduct($product, $format));

        return $orderElement;
    }
845276
public static function clearCache($iElementID)
    {
        if (empty($iElementID)) {
            return;
        }

        ItemStorage::clear(static::class, $iElementID);
        CCache::clear(static::getCacheTag(), $iElementID);
    }
586064
private function fillElement (DOMDocument $doc, DOMElement $parent, array $filler)
    {
        foreach ($filler as $name => $value) {
            if ($value instanceof DOMElement) {
                $element = $value;
            } else {
                $element = $doc->createElement($name);
                
                if (is_array($value)) {
                    $this->fillElement($doc, $element, $value);
                } else {
                    $element->appendChild(new DOMCdataSection($value));
                }
            }
            
            $parent->appendChild($element);
        }
    }
744070
public static function createFromXML( DOMElement $node )
    {
        $newObj = new eZPageZone();

        if ( $node->hasAttributes() )
        {
            foreach ( $node->attributes as $attr )
            {
                if ( $attr->name == 'id' )
                {
                    $value = explode( '_', $attr->value );
                    $newObj->setAttribute( $attr->name, $value[1] );
                }
                else
                {
                    $newObj->setAttribute( $attr->name, $attr->value );
                }
            }
        }

        foreach ( $node->childNodes as $node )
        {
            if ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'block' )
            {
                $blockNode = eZPageBlock::createFromXML( $node );
                $newObj->addBlock( $blockNode );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE )
            {
                $newObj->setAttribute( $node->nodeName, $node->nodeValue );
            }
        }

        return $newObj;
    }
483858
private function buildObject(DOMElement $data){

        $attributes = $this->extractAttributes($data);
        $returnValue = new QtiObject($attributes);

        if($data->hasChildNodes()){
            $nonEmptyChild = $this->getNonEmptyChildren($data);
            if(count($nonEmptyChild) == 1 && reset($nonEmptyChild)->nodeName == 'object'){
                $alt = $this->buildObject(reset($nonEmptyChild));
                $returnValue->setAlt($alt);
            }else{
                //get the node xml content
                $pattern = array("/^<{$data->nodeName}([^>]*)?>/i", "/<\/{$data->nodeName}([^>]*)?>$/i");
                $content = preg_replace($pattern, '', trim($this->saveXML($data)));
                $returnValue->setAlt($content);
            }
        }else{
            $alt = trim($data->nodeValue);
            if(!empty($alt)){
                $returnValue->setAlt($alt);
            }
        }

        return $returnValue;
    }
1349948
protected function createSectionDOMElement( DOMDocument $domDocument, eZSection $section )
    {
        $sectionElement = $domDocument->createElement( 'Section' );

        // Set attributes
        $sectionElement->setAttribute( 'ID', $section->attribute( 'id' ) );
        $sectionElement->setAttribute( 'name', $section->attribute( 'name' ) );

        return $sectionElement;
    }
273678
public function assignAllElementsToSubShop($sElementTable, $sShopId, $sParentShopId = 1)
    {
        /** @var \OxidEsales\Eshop\Core\Element2ShopRelations $oElement2ShopRelations */
        $oElement2ShopRelations = oxNew(\OxidEsales\Eshop\Core\Element2ShopRelations::class, $sElementTable);
        $oElement2ShopRelations->setShopIds($sShopId);
        $oElement2ShopRelations->inheritFromShop($sParentShopId);
    }
783413
public function toXML(DOMElement $parent) : DOMElement
    {
        $e = parent::toXML($parent);

        if (is_bool($this->WantAuthnRequestsSigned)) {
            $e->setAttribute('WantAuthnRequestsSigned', $this->WantAuthnRequestsSigned ? 'true' : 'false');
        }

        foreach ($this->SingleSignOnService as $ep) {
            $ep->toXML($e, 'md:SingleSignOnService');
        }

        foreach ($this->NameIDMappingService as $ep) {
            $ep->toXML($e, 'md:NameIDMappingService');
        }

        foreach ($this->AssertionIDRequestService as $ep) {
            $ep->toXML($e, 'md:AssertionIDRequestService');
        }

        Utils::addStrings($e, Constants::NS_MD, 'md:AttributeProfile', false, $this->AttributeProfile);

        foreach ($this->Attribute as $a) {
            $a->toXML($e);
        }

        return $e;
    }
1013082
protected function fieldToElement(DOMDocument $doc, string $value): DOMElement
    {
        $item = $doc->createElement($this->field_name);
        $item->appendChild($doc->createTextNode($value));

        return $item;
    }
1264609
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Constants::NS_MD, 'md:ContactPerson');
        $parent->appendChild($e);

        $e->setAttribute('contactType', $this->getContactType());

        foreach ($this->getContactPersonAttributes() as $attr => $val) {
            $e->setAttribute($attr, $val);
        }

        Extensions::addList($e, $this->getExtensions());

        if ($this->Company !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:Company', $this->Company);
        }
        if ($this->GivenName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:GivenName', $this->GivenName);
        }
        if ($this->SurName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:SurName', $this->SurName);
        }
        if (!empty($this->getEmailAddress())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:EmailAddress', false, $this->getEmailAddress());
        }
        if (!empty($this->getTelephoneNumber())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:TelephoneNumber', false, $this->getTelephoneNumber());
        }

        return $e;
    }