Html: defer rendering of array content

This commit is contained in:
Thomas Gelf 2017-02-27 12:28:40 +01:00
parent 94e29aec1d
commit be5d8116ce

View file

@ -44,9 +44,8 @@ class Html implements Renderable
*/
public function setContent($content)
{
$this->content = array(
static::escape($content)
);
$this->content = array();
static::addContent($content);
return $this;
}
@ -57,7 +56,14 @@ class Html implements Renderable
*/
public function addContent($content)
{
$this->content[] = static::escape($content);
if (is_array($content)) {
foreach ($content as $c) {
static::addContent($c);
}
} else {
$this->content[] = static::escape($content);
}
return $this;
}