CustomVariables: add render support
This commit is contained in:
parent
57d443157f
commit
93ead1f68e
|
@ -22,6 +22,7 @@ class CustomVariables
|
|||
{
|
||||
$key = (string) $key;
|
||||
|
||||
// TODO: add support for null values
|
||||
if ($value === null) {
|
||||
unset($this->$key);
|
||||
}
|
||||
|
@ -48,6 +49,17 @@ class CustomVariables
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function toConfigString()
|
||||
{
|
||||
$out = '';
|
||||
|
||||
foreach ($this->vars as $key => $var) {
|
||||
$out .= $var->toConfigString()
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->get($key);
|
||||
|
@ -89,5 +101,16 @@ class CustomVariables
|
|||
$this->properties[$key] = $this->defaultProperties[$key];
|
||||
}
|
||||
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
try {
|
||||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
restore_error_handler();
|
||||
call_user_func($previousHandler, $e);
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue