Pimcore\Model\Document\PageSnippet::setRawElement PHP Метод

setRawElement() публичный Метод

Set raw data of an element (eg. for editmode)
public setRawElement ( string $name, string $type, string $data )
$name string
$type string
$data string
    public function setRawElement($name, $type, $data)
    {
        try {
            if ($type) {
                $class = "\\Pimcore\\Model\\Document\\Tag\\" . ucfirst($type);
                // this is the fallback for custom document tags using prefixes
                // so we need to check if the class exists first
                if (!\Pimcore\Tool::classExists($class)) {
                    $oldStyleClass = "\\Document_Tag_" . ucfirst($type);
                    if (\Pimcore\Tool::classExists($oldStyleClass)) {
                        $class = $oldStyleClass;
                    }
                }
                $this->elements[$name] = new $class();
                $this->elements[$name]->setDataFromEditmode($data);
                $this->elements[$name]->setName($name);
                $this->elements[$name]->setDocumentId($this->getId());
            }
        } catch (\Exception $e) {
            Logger::warning("can't set element " . $name . " with the type " . $type . " to the document: " . $this->getRealFullPath());
        }
        return $this;
    }