2013-11-25 00:02:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\Elements;
|
|
|
|
|
2014-01-12 00:51:46 +01:00
|
|
|
use FML\Types\Renderable;
|
|
|
|
|
2013-11-25 00:02:07 +01:00
|
|
|
/**
|
2014-01-12 00:51:46 +01:00
|
|
|
* Include Element
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
|
|
|
* @author steeffeen
|
|
|
|
*/
|
|
|
|
class Including implements Renderable {
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Protected Properties
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
protected $tagName = 'include';
|
2014-01-12 00:51:46 +01:00
|
|
|
protected $url = '';
|
2013-11-25 00:02:07 +01:00
|
|
|
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Set Url
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
2014-01-12 00:51:46 +01:00
|
|
|
* @param string $url Include Url
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
public function setUrl($url) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$this->url = (string) $url;
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Renderable::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement = $domDocument->createElement($this->tagName);
|
2013-12-31 02:55:19 +01:00
|
|
|
if ($this->url) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement->setAttribute('url', $this->url);
|
2013-12-31 02:55:19 +01:00
|
|
|
}
|
2014-01-12 00:51:46 +01:00
|
|
|
return $xmlElement;
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
|
|
|
}
|