public static function fromHtml($html) { $dom = new HtmlDomParser(); $r = $dom->str_get_html($html); $nodes = $r->childNodes(); $node = $nodes[0]; $element = new Element($node->tag); foreach ($node->getAllAttributes() as $key => $value) { $element->setAttribute($key, $value); } $column = new static($element); return $column; }
public function getPresetContainerHtmlObject() { $dom = new HtmlDomParser(); $r = $dom->str_get_html($this->arrayPreset['container']); if (is_object($r)) { $nodes = $r->childNodes(); $node = $nodes[0]; if (is_object($node)) { $element = new Element($node->tag); foreach ($node->getAllAttributes() as $key => $value) { $element->setAttribute($key, $value); } } } if (!isset($element)) { $element = new Element('div'); } return $element; }
/** * @return string */ public function __toString() { $e = new Element('script'); $e->type('text/javascript')->src($this->getAssetURL()); if (count($this->combinedAssetSourceFiles)) { $source = ''; foreach ($this->combinedAssetSourceFiles as $file) { $source .= $file . ' '; } $source = trim($source); $e->setAttribute('data-source', $source); } return (string) $e; }