huge fml update

This commit is contained in:
Steffen Schröder
2014-01-19 19:30:21 +01:00
parent 9654b26f2b
commit 771409b8eb
66 changed files with 2303 additions and 134 deletions

View File

@ -16,6 +16,28 @@ class SimpleScript implements Renderable {
protected $tagName = 'script';
protected $text = '';
/**
* Create a new SimpleScript Element
*
* @param string $text (optional) Script Text
* @return \FML\Elements\SimpleScript
*/
public static function create($text = null) {
$simpleScript = new SimpleScript($text);
return $simpleScript;
}
/**
* Construct a new SimpleScript Element
*
* @param string $text (optional) Script Text
*/
public function __construct($text = null) {
if ($text !== null) {
$this->setText($text);
}
}
/**
* Set Script Text
*
@ -23,7 +45,7 @@ class SimpleScript implements Renderable {
* @return \FML\Script\Script
*/
public function setText($text) {
$this->text = $text;
$this->text = (string) $text;
return $this;
}
@ -33,8 +55,10 @@ class SimpleScript implements Renderable {
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
$scriptComment = $domDocument->createComment($this->text);
$xmlElement->appendChild($scriptComment);
if ($this->text) {
$scriptComment = $domDocument->createComment($this->text);
$xmlElement->appendChild($scriptComment);
}
return $xmlElement;
}
}