BaseElement: add createElement helper

This commit is contained in:
Thomas Gelf 2016-11-28 23:50:29 +01:00
parent 78f02ad403
commit c56c66d193

View file

@ -68,6 +68,21 @@ abstract class BaseElement extends Html
return $this->tag;
}
/**
* Container constructor.
*
* @param string $tag
* @param Attributes|array $attributes
*
* @return Element
*/
public function createElement($tag, $attributes = null)
{
$element = Element::create($tag, $attributes);
$this->add($element);
return $element;
}
public function renderContent()
{
return parent::render();