Initialize from ElementBase interface.

@param ElementBase $el
@return self
174301
public static function fromElementBase(ElementBase $el): self
    {
        // if element is already wrapped
        if ($el instanceof self) {
            return $el;
        }
        return new self($el->asElement());
    }
298965
public function setInstance(Hierarchy $element)
    {
        $class = get_class($element);
        $this->hierarchy[$class][$element->getID()] = $element;
        return $this;
    }
1017079
public function set($key, $element) {
		$key = $this->extractKey($key);
		$this->collection[$key] = $element;
		
		return $this;
	}
983917
protected function initializeRelatedElement()
    {
        $select = $this->getRelatedElement();

        $select->setName($name = $this->getRelatedForeignKeyName());
        $select->setModelAttributeKey($name);
        $select->setPath($this->getEmptyRelation()->getRelated()->getKeyName());
        $select->setModelForOptions(get_class($this->getEmptyRelation()->getRelated()));
        $select->setModel($this->getModelForElements());
        if ($display = $this->getRelatedElementDisplayName()) {
            $select->setDisplay($display);
        }
        $select->required();

        $this->unique(empty($this->unique) ? [$name]
            : array_merge([$name], $this->unique), trans('sleeping_owl::lang.form.unique'));

        if ($this->relatedWrapper) {
            $this->getElements()->forget(0);
            $column = new Column([$select]);
            $this->relatedWrapper->getElements()->prepend($column);
        }
    }
1000668
public static function toDOM(BaseElement $element): \DOMDocument
    {
        $doc = new \DOMDocument('1.0', 'utf-8');
        $doc->appendChild($element->toDOM($doc));
        return $doc;
    }
1152155
private function createElement($element)
    {
        if ($element instanceof FilterElementInformationInterface) {
            $panelElement = new DefaultFilterElement();
            return $panelElement->setPropertyName($element->getPropertyName());
        }
        if ($element instanceof LimitElementInformationInterface) {
            return new DefaultLimitElement();
        }
        if ($element instanceof SearchElementInformationInterface) {
            return $this->buildSearchElement($element);
        }
        if ($element instanceof SortElementInformationInterface) {
            return new DefaultSortElement();
        }
        if ($element instanceof SubmitElementInformationInterface) {
            return new DefaultSubmitElement();
        }

        return null;
    }
1025162
protected function setAttributes(SimpleXMLElement $element)
    {
        $nb_parent = $this->nb_data_object->getTranslatedObject();
        if ($nb_parent !== null) {
            $nb_language = $nb_parent->getLanguage($this->nb_data_object->getLanguageId());
            $element->addAttribute('lang', $nb_language->grantHash(true));
            $this->putAttributesFromList($element, array(
                'nb_site_target_section_main_image' => 'image'
            ), false);
        }
    }
949215
public function push(...$elements): self
    {
        foreach ($elements as $element) {
            $this->validate($element);

            $this->elements[] = $element;
        }

        return $this;
    }
644673
public function loadDefaultElements()
    {
        $this->getOrganizationElement();
        $this->getUserNameElement();
        $this->getSubmitButton();
        $this->getLoginLinkElement();

        return $this;
    }
44767
public function before()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            if ($node->parentNode instanceof \DOMDocument) {
                throw new \Exception('Can not set before root element '.$node->tagName.' of document');
            }

            $node->parentNode->insertBefore($imported_node, $node);
        });

        return $this;
    }
474530
public function add($element) {
		if (!in_array($element, $this->collection, true)) {
			$this->collection[$this->size()] = $element;
		}

		return $this;
	}
894018
public function forElement(Element $el)
    {
        // Add help
        $this->model($el)->blockhelp($el->help);

        // Populate the image array with the image instance.  This will create an
        // Image instance from the default value if it doesn't exist.
        $pop = app('former.populator')->all();
        $pop['images'][$this->inputId()] = $el->img();
        app('former.populator')->replace($pop);

        // Support chaining
        return $this;
    }
1035997
protected function validateElement(BaseElement $element) : void
    {
        if ($element instanceof Break_) {
            $this->validateBreak($element);
        } elseif ($element instanceof Phoneme) {
            $this->validatePhoneme($element);
        } elseif ($element instanceof SayAs) {
            $this->validateSayAs($element);
        } elseif ($element instanceof Word) {
            $this->validateWord($element);
        }
    }
798876
public function withReplaced(int $idx, Element $el): self
    {
        if (!isset($this->_elements[$idx])) {
            throw new \OutOfBoundsException(
                "Structure doesn't have element at index $idx.");
        }
        $obj = clone $this;
        $obj->_elements[$idx] = $el;
        return $obj;
    }
1334717
protected function init(DOMElement $element)
    {
        $this->parseType($element, false);

        for ($i = 0; $i < $element->childNodes->length; $i++) {
            /** @var DOMElement $child */
            $child = $element->childNodes->item($i);

            if ($child instanceof DOMNode) {
                if ('condition' === $child->nodeName) {
                    $condition = DescriptorFactory::getFactory()->createConditionDescriptor($child);
                    $this->conditions->attach($condition);
                } elseif ('conditions' === $child->nodeName) {
                    $condition = DescriptorFactory::getFactory()->createConditionsDescriptor($child);
                    $this->conditions->attach($condition);
                }
            }
        }
    }
1373340
public function setElement($element = null)
    {
        $this->element = null;

        if (!$element = $this->internalResolveElement($element)) {
            $this->element = $this->elementId = null;
        } else {
            /** @var Element $element */
            $this->elementId = $element->id;
            $this->element = $element;
        }

        return $this;
    }
265440
public function init($request)
    {
        $sElementTable = $request->getParameter("elementtable");
        $sShopId = $request->getParameter("shopid");
        $sParentShopId = $request->getParameter("parentshopid");
        $sElementId = $request->getParameter("elementid");
        if ($sElementId) {
            $this->assignElementToSubShop($sElementTable, $sShopId, $sElementId);
        } else {
            $this->assignAllElementsToSubShop($sElementTable, $sShopId, $sParentShopId);
        }
    }